Skip to content

Commit

Permalink
fix: fallback for determining age stratifier
Browse files Browse the repository at this point in the history
  • Loading branch information
torbrenner committed Sep 5, 2024
1 parent cb4c909 commit 0b334b4
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion resources/cql/DKTK_STRAT_AGE_STRATIFIER
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,12 @@ from [Condition] C
where C.extension.where(url='http://hl7.org/fhir/StructureDefinition/condition-related').empty() and C.onset is not null
sort by date from onset asc)

define FirstDiagnosis:
First(
from [Condition] C
sort by date from onset asc)

define AgeClass:
if (PrimaryDiagnosis.onset is null) then 'unknown' else ToString((AgeInYearsAt(FHIRHelpers.ToDateTime(PrimaryDiagnosis.onset)) div 10) * 10)
if (PrimaryDiagnosis.onset is null)
then ToString((AgeInYearsAt(FHIRHelpers.ToDateTime(FirstDiagnosis.onset)) div 10) * 10)
else ToString((AgeInYearsAt(FHIRHelpers.ToDateTime(PrimaryDiagnosis.onset)) div 10) * 10)

0 comments on commit 0b334b4

Please sign in to comment.