diff --git a/.dbtignore b/.dbtignore new file mode 100644 index 00000000..212cd2c0 --- /dev/null +++ b/.dbtignore @@ -0,0 +1,2 @@ +# .dbtignore +init.sql diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 00000000..2e27f2ea --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,36 @@ +--- +name: Bug report +about: Create a report to help us improve +title: '' +labels: 'Type: Bug' +assignees: '' + +--- + + + +**Describe the bug** + + +**To Reproduce** + +1. Step 1 +2. Step 2 + +**Expected behavior** + + +**Logs** + + +**Screenshots** + + +**Environment** +- Instance +- Client platform: (eg: Windows, MacOS, Linux) + +**Additional context** + diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 00000000..b92c70cb --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,2 @@ +blank_issues_enabled: true + diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 00000000..4a539a69 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,20 @@ +--- +name: Feature request +about: Suggest an idea for this project +title: '' +labels: 'Type: Feature' +assignees: '' + +--- + +**Is your feature request related to a problem? Please describe.** + + +**Describe the solution you'd like** + + +**Describe alternatives you've considered** + + +**Additional context** + diff --git a/.github/ISSUE_TEMPLATE/improvement.md b/.github/ISSUE_TEMPLATE/improvement.md new file mode 100644 index 00000000..ecdbe888 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/improvement.md @@ -0,0 +1,20 @@ +--- +name: Improvement +about: Suggest something to make an existing feature better +title: '' +labels: 'Type: Improvement' +assignees: '' + +--- + +**What feature do you want to improve?** + + +**Describe the improvement you'd like** + + +**Describe alternatives you've considered** + + +**Additional context** + diff --git a/.github/ISSUE_TEMPLATE/technical_issue.md b/.github/ISSUE_TEMPLATE/technical_issue.md new file mode 100644 index 00000000..62040926 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/technical_issue.md @@ -0,0 +1,17 @@ +--- +name: Technical issue +about: Suggest an improvement users won't notice +title: '' +labels: 'Type: Technical issue' +assignees: '' + +--- + +**Describe the issue** + + +**Describe the improvement you'd like** + + +**Describe alternatives you've considered** + diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 92337ddf..82dcd46c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -19,4 +19,4 @@ jobs: if: steps.get-docker-hub-username.outputs.dockerhub_username - name: Run dbt and tests run: ./run_dbt_tests.sh - working-directory: ./test + working-directory: ./tests diff --git a/CHANGELOG.md b/CHANGELOG.md index 278f1841..e419d0ae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## [1.1.1](https://github.com/medic/cht-pipeline/compare/v1.1.0...v1.1.1) (2024-09-04) + + +### Bug Fixes + +* **#156:** unit test fixture not found when integrating with cht-sync ([#158](https://github.com/medic/cht-pipeline/issues/158)) ([ad88744](https://github.com/medic/cht-pipeline/commit/ad88744a4827824e290d474f4af8e82d64288e5f)), closes [#156](https://github.com/medic/cht-pipeline/issues/156) + # [1.1.0](https://github.com/medic/cht-pipeline/compare/v1.0.0...v1.1.0) (2024-09-02) diff --git a/README.md b/README.md index 95cdd917..e7f2e5c2 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,7 @@ -# CHT Pipeline - -CHT Pipeline is a set of SQL queries that transform raw CouchDB data into a more useful format. It uses `dbt` to define the models that are translated into PostgreSQL tables or views, which makes it easier to query the data in the analytics platform of choice. +A set of SQL queries that transform raw CouchDB data into a more useful format. It uses `dbt` to define the models that are translated into PostgreSQL tables or views, which makes it easier to query the data in the analytics platform of choice. ## Local Setup -Follow the instructions in [the Local CHT Sync Setup documentation](https://docs.communityhealthtoolkit.org/apps/guides/data/analytics/setup/) to set up CHT Sync with CHT Pipeline locally. +Follow the instructions in [the Local CHT Sync Setup documentation](https://docs.communityhealthtoolkit.org/apps/guides/data/analytics/setup/) to set up CHT Sync locally. ## Run dbt models unit tests locally diff --git a/dbt_project.yml b/dbt_project.yml index 249bf171..b2ecd57d 100644 --- a/dbt_project.yml +++ b/dbt_project.yml @@ -5,5 +5,5 @@ config-version: 2 # This setting configures which "profile" dbt uses for this project. profile: 'default' -on-run-end: +on-run-end: - "{{ log_dbt_results(results) }}" diff --git a/tests/dbt/Dockerfile b/tests/dbt/Dockerfile index e0549922..17c3f6cb 100644 --- a/tests/dbt/Dockerfile +++ b/tests/dbt/Dockerfile @@ -1,26 +1,24 @@ FROM python:3 AS testing -RUN pip install flake8 - -RUN flake8 dbt-run.py +RUN pip install flake8 \ + && flake8 dbt-run.py FROM python:3 AS release RUN pip install --upgrade cffi \ && pip install cryptography~=3.4 \ - && pip install dbt-core dbt-postgres - -RUN adduser dbt + && pip install dbt-core dbt-postgres \ + && adduser dbt USER dbt WORKDIR /dbt/ -COPY test/profiles.yml profiles.yml +COPY tests/profiles.yml profiles.yml COPY dbt_project.yml dbt_project.yml COPY packages.yml packages.yml COPY models models COPY macros macros -COPY test/fixtures tests/fixtures -COPY test/sqltest tests -COPY test/run_dbt_tests_docker.sh run_dbt_tests_docker.sh +COPY tests/fixtures tests/fixtures +COPY tests/sqltest tests +COPY tests/run_dbt_tests_docker.sh run_dbt_tests_docker.sh CMD ["bash", "./run_dbt_tests_docker.sh"] diff --git a/tests/docker-compose.yml b/tests/docker-compose.yml index dd4b3644..077c2137 100644 --- a/tests/docker-compose.yml +++ b/tests/docker-compose.yml @@ -15,7 +15,7 @@ services: dbt: build: context: ../ - dockerfile: ./test/dbt/Dockerfile + dockerfile: ./tests/dbt/Dockerfile environment: - POSTGRES_HOST=postgres - POSTGRES_USER=pipelinetest diff --git a/tests/sqltest/patient.sql b/tests/sqltest/patient.sql index d83ac460..b803905c 100644 --- a/tests/sqltest/patient.sql +++ b/tests/sqltest/patient.sql @@ -1,5 +1,5 @@ SELECT -FROM v1.couchdb couchdb +FROM {{ source('couchdb', env_var('POSTGRES_TABLE')) }} couchdb LEFT JOIN {{ ref('patient') }} patient ON couchdb._id = patient.uuid WHERE couchdb._deleted = false