diff --git a/.github/workflows/docker-build-push-ghcr.yml b/.github/workflows/docker-build-push-ghcr.yml new file mode 100644 index 0000000..ef5e4be --- /dev/null +++ b/.github/workflows/docker-build-push-ghcr.yml @@ -0,0 +1,82 @@ +name: Docker-ghcr + +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. + +on: + push: + branches: [ "main", DEV-932 ] + # Publish semver tags as releases. + tags: [ 'v*.*.*' ] + +env: + # Use docker.io for Docker Hub if empty + REGISTRY: ghcr.io + # github.repository as / + IMAGE_NAME: ${{ github.repository }}-${{ github.head_ref || github.ref_name }} + + +jobs: + build-push: + + runs-on: ubuntu-latest + environment: ${{ github.head_ref || github.ref_name }} + permissions: + contents: read + packages: write + # This is used to complete the identity challenge + # with sigstore/fulcio when running outside of PRs. + id-token: write + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + # Workaround: https://github.com/docker/build-push-action/issues/461 + - name: Setup Docker buildx + uses: docker/setup-buildx-action@v3 + + # Login against a Docker registry except on PR + # https://github.com/docker/login-action + - name: Log into registry ${{ env.REGISTRY }} + if: github.event_name != 'pull_request' + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: USEPA + password: ${{ secrets.GITHUB_TOKEN }} + + # Extract metadata (tags, labels) for Docker + # https://github.com/docker/metadata-action + - name: Extract Docker metadata + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + tags: latest + + # Build and push Docker image with Buildx (don't push on PR) + # https://github.com/docker/build-push-action + - name: Build and push Docker image + id: build-and-push + uses: docker/build-push-action@v4 + with: + context: . + file: ./Dockerfile + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + cache-from: type=gha + cache-to: type=gha,mode=max + + + # Removing old packages and only keeping 3 untagged versions + - name: Delete Package Versions + uses: actions/delete-package-versions@v5 + with: + package-name: litconnector-${{ github.head_ref || github.ref_name }} + package-type: 'container' + min-versions-to-keep: 3 + delete-only-untagged-versions: 'true' diff --git a/pyproject.toml b/pyproject.toml index d4c99e3..55626f9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -15,7 +15,6 @@ dependencies = [ "streamlit>=1.38.0", ] - [tool.setuptools.packages.find] where = ["src"] diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..0060c40 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,6 @@ +mlxtend>=0.23.1 +numpy==1.24.0 +pandas==1.5.2 +rispy>=0.9.0 +streamlit-agraph>=0.0.45 +streamlit>=1.38.0 \ No newline at end of file diff --git a/src/network_analysis.py b/src/network_analysis.py index 5da9afb..4150a0e 100644 --- a/src/network_analysis.py +++ b/src/network_analysis.py @@ -92,7 +92,7 @@ def return_assoc_rules(df, min_support, sort_by, max_len): frequent_itemsets = apriori( df, min_support=min_support, use_colnames=True, max_len=max_len ) - assoc_rules = association_rules(frequent_itemsets, min_threshold=0) + assoc_rules = association_rules(frequent_itemsets, num_itemsets=2, min_threshold=0) pmi = assoc_rules["support"] / ( assoc_rules["antecedent support"] * assoc_rules["consequent support"]