Skip to content

Commit

Permalink
Merge branch 'main' into 144-add-macros-to-reduce-boilerplate
Browse files Browse the repository at this point in the history
  • Loading branch information
witash committed Sep 5, 2024
2 parents 547f2cc + 4ccdfc7 commit d57469e
Show file tree
Hide file tree
Showing 13 changed files with 118 additions and 18 deletions.
2 changes: 2 additions & 0 deletions .dbtignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# .dbtignore
init.sql
36 changes: 36 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: 'Type: Bug'
assignees: ''

---

<!--
**Important**: This is a public repository. Anyone in the world can see what's posted here. If you are posting screenshots or log files, please **carefully examine them for** the presence of any kind of **protected health information** (PHI). Images or logs containing PHI _must_ be posted in fully-redacted form, with no visible PHI.
-->

**Describe the bug**
<!-- A clear and concise description of what the bug is. -->

**To Reproduce**
<!-- Steps to reproduce the behavior. -->
1. Step 1
2. Step 2

**Expected behavior**
<!-- A clear and concise description of what you expected to happen. -->

**Logs**
<!-- If applicable, include the server logs, and/or browser logs. -->

**Screenshots**
<!-- If applicable, add screenshots to help explain your problem. -->

**Environment**
- Instance
- Client platform: (eg: Windows, MacOS, Linux)

**Additional context**
<!-- Add any other context about the problem here. What have you tried? Is there a workaround? -->
2 changes: 2 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
blank_issues_enabled: true

20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -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.**
<!-- A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] -->

**Describe the solution you'd like**
<!-- A clear and concise description of what you want to happen. -->

**Describe alternatives you've considered**
<!-- A clear and concise description of any alternative solutions or features you've considered. -->

**Additional context**
<!-- Add any other context or screenshots about the feature request here. -->
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/improvement.md
Original file line number Diff line number Diff line change
@@ -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?**
<!-- A clear and concise description of what the problem is. Ex. It would be better to [...] -->

**Describe the improvement you'd like**
<!-- A clear and concise description of what you want to happen. -->

**Describe alternatives you've considered**
<!-- A clear and concise description of any alternative solutions or features you've considered. -->

**Additional context**
<!-- Add any other context or screenshots about the feature request here. -->
17 changes: 17 additions & 0 deletions .github/ISSUE_TEMPLATE/technical_issue.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
name: Technical issue
about: Suggest an improvement users won't notice
title: ''
labels: 'Type: Technical issue'
assignees: ''

---

**Describe the issue**
<!-- A clear and concise description of what the problem is. -->

**Describe the improvement you'd like**
<!-- A clear and concise description of what you want to change. -->

**Describe alternatives you've considered**
<!-- A clear and concise description of any alternative solutions or features you've considered. -->
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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)


Expand Down
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down
2 changes: 1 addition & 1 deletion dbt_project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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) }}"
18 changes: 8 additions & 10 deletions tests/dbt/Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]
2 changes: 1 addition & 1 deletion tests/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ services:
dbt:
build:
context: ../
dockerfile: ./test/dbt/Dockerfile
dockerfile: ./tests/dbt/Dockerfile
environment:
- POSTGRES_HOST=postgres
- POSTGRES_USER=pipelinetest
Expand Down
2 changes: 1 addition & 1 deletion tests/sqltest/patient.sql
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit d57469e

Please sign in to comment.