Skip to content

Commit

Permalink
Merge pull request #198 from cqframework/conversion-factors-codesystem
Browse files Browse the repository at this point in the history
Added CDCMMEClinicalConversionFactors codesystem using CQL
  • Loading branch information
Capt-Mac authored Aug 11, 2022
2 parents 23f3b2b + 9e397fb commit 5ea3963
Show file tree
Hide file tree
Showing 24 changed files with 800 additions and 730 deletions.
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
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

0 comments on commit 5ea3963

Please sign in to comment.