Files
ISSSTELEON/Persistance/dbt/models/gold/cacu/cacu_sample_biopsies.sql
T
alberto 781e1ea75a C1a: code only, no comments, no Markdown
The four Markdown files (README.md, tests/fixtures/ados2_items_by_module.md, tools/delivery/README.md, tools/delivery/README.repo.md) live in the outer repo under docs/ISSSTELEON; the delivery scripts no longer produce a README and the ADOS-2 expected values stay in the Python test.
2026-12-01 16:56:14 -06:00

15 lines
605 B
SQL

{% set p = var('cacu') %}
select
{{ dbt.concat(['b.person_id', "'|'", 'cast(b.cytology_sample_date as ' ~ dbt.type_string() ~ ')']) }} as sample_id,
{{ dbt.concat(['b.person_id', "'|'", 'cast(b.request_date as ' ~ dbt.type_string() ~ ')']) }} as biopsy_id,
b.report_date, b.histology, b.known_at,
case
when b.histology is null then -1
{%- for grade in p.biopsy_severity %}
when b.histology = '{{ grade }}' then {{ loop.index }}
{%- endfor %}
else 0
end as severity
from {{ ref('cervical_biopsy') }} as b
where b.cytology_sample_date is not null