Skip to content

feat(seeds): add central cohort definitions registry#419

Open
julianam-w wants to merge 2 commits into
mainfrom
feature/cohort-definitions-registry
Open

feat(seeds): add central cohort definitions registry#419
julianam-w wants to merge 2 commits into
mainfrom
feature/cohort-definitions-registry

Conversation

@julianam-w

Copy link
Copy Markdown
Collaborator

Summary

  • Introduces seeds/cohort_definitions.csv as the authoritative source of cohort_definition_id values across all BES deployments
  • Deployment-specific coh__ models must reference IDs from this registry — never assign one locally
  • Adds seeds/cohort_definitions.yml with schema documentation and not_null / unique tests on the primary key
  • Seeds the registry with cohort_definition_id = 1 for the NCD program registry

This supports the OMOP-inspired cohort conventions introduced in the .maui submodule (see maui-team #10).

Test plan

  • dbt seed --profiles-dir config --select cohort_definitions runs without error
  • dbt test --profiles-dir config --select cohort_definitions passes (not_null, unique)
  • Review NCD registry entry — confirm omop_concept_id 4214956 (SNOMED: Non-communicable disease) is appropriate

🤖 Generated with Claude Code

julianam-w and others added 2 commits April 12, 2026 16:59
Introduces seeds/cohort_definitions.csv as the authoritative source of
cohort_definition_id values across all BES deployments. Deployment-specific
coh__ models must reference IDs from this registry rather than assigning
them locally.

Registers the NCD program registry as cohort_definition_id = 1.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Apr 12, 2026

Copy link
Copy Markdown
Contributor

Claude finished @julianam-w's task in 1m 31s —— View job


PR Review

  • Gather context and read changed files
  • Analyze PR changes
  • Post review feedback

⚠️ Issues found — 0 blockers, 2 suggestions, 1 nit


seeds/cohort_definitions.csv + seeds/cohort_definitions.yml

The structure is clean and well-documented. The not_null + unique tests on both cohort_definition_id and cohort_name are appropriate for a registry with a machine-readable key.


🟡 Suggestion — Missing column_types for integer columns

dbt loads all CSV seed columns as varchar/text by default. Without explicit column_types, cohort_definition_id and omop_concept_id will be materialised as strings. If downstream coh__ models join against this seed expecting integer IDs, some databases will silently coerce or return no rows on type mismatch.

Add a seeds: block to dbt_project.yml:

seeds:
  tamanu_source_dbt:
    cohort_definitions:
      +column_types:
        cohort_definition_id: integer
        omop_concept_id: integer

Fix this →


🟡 Suggestion — PR title uses feat, project convention is feature

Per .maui/REVIEW.md, valid types are feature, fix, hotfix, chore, refactor, docs. The title currently uses feat (a common shorthand but not the project standard).

gh pr edit 419 --title 'feature(seeds): add central cohort definitions registry'

🔵 Nit — No tests on omop_concept_id / vocabulary_id

If OMOP alignment is a hard requirement for every registered cohort (which the description implies), adding not_null tests would enforce that future entries can't silently omit these fields. Not blocking, but worth considering given the stated OMOP intent.


Regression testing

dbt seed --profiles-dir config --select cohort_definitions
dbt test --profiles-dir config --select cohort_definitions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant