A dbt project of Tamanu's standard models. This includes:
- raw (or source) schema
- reporting schema
- analytics schema (upcoming)
This project includes AI rules for AI assistants located in the ai/ directory.
To use these AI rules with Cline or Cursor, you need to create a symbolic link to the ai/ directory to make the rules accessible to your AI assistant.
We use SQLFluff and the configuration file is located in the root folder and is named .sqlfluff.
There are two commands available to run:
sqlfluff lint models- Lints the file (does not apply fix)sqlfluff fix models- Fixes the SQL files
To refresh the source models from the Tamanu repository, execute the following command:
python scripts/refresh_tamanu_source.py
This command pulls the source model information from the Tamanu repository based on the version specified in the dbt_project.yml file. All models located under the tamanu/database/model/central-server/public/ folder (remote tamanu repository) will be copied to the models/sources/ folder (local repository).
Execute the following command:
python ./scripts/build_reporting_assets.py
This command generates views, reports, and an import script for deployment in the .\compiled\ folder. The following outputs are created:
- Dataset SQL scripts: Saved in compiled/views/reporting_schema_build_script.sql.
- Compiled report JSON files: Saved in compiled/reports.
- Import script: Saved as compiled/reports/importReports.js
To automatically generate dbt models and documentation for surveys from database, execute the following command:
python scripts/generate_survey_models.py
This will generate models and documentation for all surveys in the Tamanu database.
This script generates a list of all reports in the repository and outputs the result in a Markdown file.
To generate a report list:
python list_tamanu_reports.py
We will use semantic versioning < major >.< minor >.< patch >. This number will mirror Tamanu's release
< major >.< minor > version numbers with the < patch > number for patching within this repository.
- Click on "Releases"
- Click "Draft a new release"
- You can select a branch to make the release from, but usually you'd release from
main. - Give your release a "tag". This is the version number of the release.