Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added CDCMMEClinicalConversionFactors codesystem using CQL #198

Merged
merged 5 commits into from
Aug 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
104 changes: 104 additions & 0 deletions input/pagecontent/cql/CDCMMEClinicalConversionFactors.cql
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
library CDCMMEClinicalConversionFactors version '3.0.0'

using FHIR version '4.0.1'

define CDCMMEClinicalConversionFactorsCodeSystem:
CodeSystem {
name: string { value: 'CDCMMEClinicalConversionFactors' },
supplements: canonical { value: 'http://www.nlm.nih.gov/research/umls/rxnorm' },
concept: List<FHIR.CodeSystem.Concept> {
FHIR.CodeSystem.Concept {
code: code { value: '2670' },
display: string { value: 'Codeine' },
property: List<FHIR.CodeSystem."Concept"."Property"> {
FHIR.CodeSystem."Concept"."Property" {
code: code { value: 'conversion-factor' },
value: decimal { value: 0.15 }
}
}
},
FHIR.CodeSystem.Concept {
code: code { value: '4337' },
display: string { value: 'Fentanyl' },
property: List<FHIR.CodeSystem."Concept"."Property"> {
FHIR.CodeSystem."Concept"."Property" {
code: code { value: 'dose-form-conversion-factor' },
value: string { value: '316987:7200@0.33333333' }
}
}
},
FHIR.CodeSystem.Concept {
code: code { value: '3423' },
display: string { value: 'Hydromorphone' },
property: List<FHIR.CodeSystem."Concept"."Property"> {
FHIR.CodeSystem."Concept"."Property" {
code: code { value: 'conversion-factor' },
value: decimal { value: 4 }
}
}
},
FHIR.CodeSystem.Concept {
code: code { value: '5489' },
display: string { value: 'Hydrocodone' },
property: List<FHIR.CodeSystem."Concept"."Property"> {
FHIR.CodeSystem."Concept"."Property" {
code: code { value: 'conversion-factor' },
value: decimal { value: 1 }
}
}
},
FHIR.CodeSystem.Concept {
code: code { value: '6813' },
display: string { value: 'Methadone' },
property: List<FHIR.CodeSystem."Concept"."Property"> {
FHIR.CodeSystem."Concept"."Property" {
code: code { value: 'dose-range-conversion-factor' },
value: string { value: '1-20:4' }
},
FHIR.CodeSystem."Concept"."Property" {
code: code { value: 'dose-range-conversion-factor' },
value: string { value: '21-40:8' }
},
FHIR.CodeSystem."Concept"."Property" {
code: code { value: 'dose-range-conversion-factor' },
value: string { value: '41-60:10' }
},
FHIR.CodeSystem."Concept"."Property" {
code: code { value: 'dose-range-conversion-factor' },
value: string { value: '61-*:12' }
}
}
},
FHIR.CodeSystem.Concept {
code: code { value: '7052' },
display: string { value: 'Morphine' },
property: List<FHIR.CodeSystem."Concept"."Property"> {
FHIR.CodeSystem."Concept"."Property" {
code: code { value: 'conversion-factor' },
value: decimal { value: 1 }
}
}
},
FHIR.CodeSystem.Concept {
code: code { value: '7804' },
display: string { value: 'Oxycodone' },
property: List<FHIR.CodeSystem."Concept"."Property"> {
FHIR.CodeSystem."Concept"."Property" {
code: code { value: 'conversion-factor' },
value: decimal { value: 1.5 }
}
}
},
FHIR.CodeSystem.Concept {
code: code { value: '7814' },
display: string { value: 'Oxymorphone' },
property: List<FHIR.CodeSystem."Concept"."Property"> {
FHIR.CodeSystem."Concept"."Property" {
code: code { value: 'conversion-factor' },
value: decimal { value: 3 }
}
}
}
}
}

29 changes: 16 additions & 13 deletions input/pagecontent/cql/ConversionFactors.cql
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ All conversion factors supplied in these supplements are in 'mg/d'.
using FHIR version '4.0.1'

include FHIRHelpers version '4.0.1'

include CDCMMEClinicalConversionFactors version '3.0.0' called CDCMMEClinicalConversionFactors

codesystem "Usage Context Type": 'http://terminology.hl7.org/CodeSystem/usage-context-type'
codesystem "CDC MME Usage Context Codes": 'http://fhir.org/guides/cdc/opioid-mme-r4/CodeSystem/CDCMMEUsageContextCodes'
Expand Down Expand Up @@ -122,19 +122,22 @@ define function GetConversionFactor(ingredientCode System.Code, dailyDose System
end
)

/*
The use of the CDCMMEClinicalConversionFactors is a workaround for the fact that we can't retrieve the formally
defined CodeSystem resource (https://fhir.org/guides/cdc/opioid-mme-r4/CodeSystem-CDCMMEClinicalConversionFactors.html)
from the FHIR server
*/
define ConversionFactorSupplement:
singleton from (
[CodeSystem] C
where C.supplements.value = 'http://www.nlm.nih.gov/research/umls/rxnorm'
and (
C.name.value = ConversionFactorSupplementName
or exists (
C.useContext UC
where UC.code ~ "Task Usage Context"
and UC.value ~ "MME Calculation"
)
)
)
CDCMMEClinicalConversionFactors."CDCMMEClinicalConversionFactorsCodeSystem" C
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, exactly, please just add a comment that this is a workaround for the fact that we can't retrieve the CodeSystem resource from the FHIR server.

where C.supplements.value = 'http://www.nlm.nih.gov/research/umls/rxnorm'
and (
C.name.value = ConversionFactorSupplementName
or exists (
C.useContext UC
where UC.code ~ "Task Usage Context"
and UC.value ~ "MME Calculation"
)
)

/*
Converts a range value boundary to a Decimal (or null for a wildcard)
Expand Down
29 changes: 29 additions & 0 deletions input/resources/library/CDCMMEClinicalConversionFactors.json

Large diffs are not rendered by default.

Loading