Skip to content

Commit

Permalink
WSG-102 Profile Authoring (#52)
Browse files Browse the repository at this point in the history
* First pass at core profiles

* Profiling

* Previous work

* Fixed generation

* Unintended change removed
  • Loading branch information
pmanko authored Aug 18, 2024
1 parent 41e9f94 commit 8f38792
Show file tree
Hide file tree
Showing 27 changed files with 309 additions and 11 deletions.
16 changes: 10 additions & 6 deletions input/cql/HIVElements.cql
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,17 @@ define "PREP Prescription":
[MedicationRequest] MR
where MR.status = 'completed'
and MR.intent = 'order'
and MR.medication ~ Concepts."PrEP for HIV prevention"
and (MR.medication as CodeableConcept in Concepts."PrEP product prescribed Choices"
or MR.medication as CodeableConcept in Concepts."Current PrEP regimen Choices")

define "PEP Prescription":
[MedicationRequest] MR
where MR.status = 'completed'
and MR.intent = 'order'
and MR.medication ~ Concepts."PEP for HIV prevention"
and (MR.medication as CodeableConcept in Concepts."Preferred PEP backbone regimen Choices"
or MR.medication as CodeableConcept in Concepts."Alternative PEP backbone regimen Choices"
or MR.medication as CodeableConcept in Concepts."Preferred third PEP drug Choices"
or MR.medication as CodeableConcept in Concepts."Alternative third PEP drug Choices")

define "routine viral load sample collection":
[Procedure] P
Expand Down Expand Up @@ -2580,10 +2584,10 @@ define "HIV retest prior to starting ART conducted Observation":
*/

define "At elevated risk for HIV acquisition B.DE225":
[Observation] O
where O.status in { 'final', 'amended', 'corrected' }
and exists(O.category OC where OC ~ ConceptsCustom."social-history")
and O.code ~ Concepts."At elevated risk for HIV acquisition - HIV.B.DE225"
[Condition] C
where C.code ~ Concepts."At elevated risk for HIV acquisition - HIV.B.DE225"
and C.verificationStatus.text = 'confirmed'

/* End of At elevated risk for HIV acquisition B.DE225 */

/*
Expand Down
7 changes: 4 additions & 3 deletions input/cql/HIVEncounterElements.cql
Original file line number Diff line number Diff line change
Expand Up @@ -1665,9 +1665,9 @@ define "HIV retest prior to starting ART conducted Observation":
@description: Client is at elevated risk for HIV acquisition
*/
define "At elevated risk for HIV acquisition B.DE225":
Elements."At elevated risk for HIV acquisition B.DE225" O
where O.encounter.references(EncounterId)
or O.effective.toInterval() starts on or before Today
Elements."At elevated risk for HIV acquisition B.DE225" C
where C.prevalenceInterval() starts on or before Today
or C.encounter.references(EncounterId)
/* End of At elevated risk for HIV acquisition B.DE225 */

/*
Expand Down Expand Up @@ -1696,6 +1696,7 @@ define "Positive B.DE251":
define "Positive B.DE251 Condition":
Elements."Positive B.DE251 Condition" C
where C.prevalenceInterval() starts on or before Today
or C.encounter.references(EncounterId)
define "Positive B.DE251 Observation":
Elements."Positive B.DE251 Observation" O
where O.encounter.references(EncounterId)
Expand Down
4 changes: 2 additions & 2 deletions input/cql/HIVIndicatorElements.cql
Original file line number Diff line number Diff line change
Expand Up @@ -1558,8 +1558,8 @@ define "Other B.DE222 Observation":
*/

define "At elevated risk for HIV acquisition B.DE225":
exists(Elements."At elevated risk for HIV acquisition B.DE225" O
where O.effective.toInterval() overlaps "Measurement Period")
exists(Elements."At elevated risk for HIV acquisition B.DE225" C
where C.prevalenceInterval() overlaps "Measurement Period")
/* End of At elevated risk for HIV acquisition B.DE225 */

/*
Expand Down
9 changes: 9 additions & 0 deletions input/fsh/examples/HivElevatedRiskForAcquisition.fsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Instance: ExampleElevatedHivRiskCondition
InstanceOf: HivElevatedRiskForAcquisition
Title: "Example Elevated HIV Risk Condition"
Description: "This is an example of an Elevated HIV Risk Condition resource based on the HivElevatedRiskForAcquisition profile."

* verificationStatus = #confirmed
* code = HIVConcepts#HIV.B.DE225
* subject = Reference(Patient/example-hiv-patient)
* onsetDateTime = "2023-01-11T10:00:00Z"
11 changes: 11 additions & 0 deletions input/fsh/examples/HivKeyPopulation.fsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Instance: ExampleHivKeyPopulation
InstanceOf: HivKeyPopulation
Title: "Example HIV Key Population Observation"
Description: "This is an example of an HIV Key Population Observation resource based on the HivKeyPopulation profile."

* status = #final
* category = http://terminology.hl7.org/CodeSystem/observation-category#social-history
* code = HIVConcepts#HIV.B.DE50 "Key Population Status"
* subject = Reference(Patient/HivPatient)
* effectiveDateTime = "2023-01-12T14:00:00Z"
* valueCodeableConcept = HIVConcepts#HIV.B.DE52 "Men who have sex with men"
10 changes: 10 additions & 0 deletions input/fsh/examples/HivOnArt.fsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Instance: ExampleHivOnArt
InstanceOf: HivOnArt
Title: "Example HIV On ART Medication Statement"
Description: "This is an example of an On ART Medication Statement resource based on the HivOnArtMedicationStatement profile."

* status = #active
* medicationCodeableConcept = HIVConcepts#HIV.D.DE91
* subject = Reference(Patient/example-hiv-patient)
* effectiveDateTime = "2022-01-17T12:00:00Z"
* reasonCode = HIVConcepts#HIV.D.DE38
4 changes: 4 additions & 0 deletions input/fsh/examples/HivPatient.fsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Instance: ExampleHivPatient
InstanceOf: HivPatient

* id = "example-hiv-patient"
45 changes: 45 additions & 0 deletions input/fsh/examples/HivPepPrescriptions.fsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
Instance: ExamplePreferredPepBackbonePrescription
InstanceOf: HivPreferredPepBackbonePrescription
Title: "Example Preferred PEP Backbone Prescription"
Description: "This is an example of a preferred PEP backbone prescription resource based on the PreferredPepBackbonePrescription profile."

* status = #completed
* intent = #order
* medicationCodeableConcept = HIVConcepts#HIV.C.DE92 "TDF + 3TC"
* subject = Reference(Patient/example-hiv-patient)
* authoredOn = "2023-01-12T14:00:00Z"

Instance: ExampleAltPepBackbonePrescription
InstanceOf: HivAltPepBackbonePrescription
Title: "Example Alternative PEP Backbone Prescription"
Description: "This is an example of an alternative PEP backbone prescription resource based on the AltPepBackbonePrescription profile."

* status = #completed
* intent = #order
* medicationCodeableConcept = HIVConcepts#HIV.C.DE96 "ABC + 3TC"
* subject = Reference(Patient/example-hiv-patient)
* authoredOn = "2023-01-11T14:00:00Z"

Instance: ExamplePreferredThirdPepPrescription
InstanceOf: HivPreferredThirdPepPrescription
Title: "Example Preferred Third PEP Prescription"
Description: "This is an example of a preferred third PEP prescription resource based on the PreferredThirdPepPrescription profile."

* status = #completed
* intent = #order
* medicationCodeableConcept = HIVConcepts#HIV.C.DE100 "DTG"
* subject = Reference(Patient/example-hiv-patient)
* authoredOn = "2023-01-14T14:00:00Z"

Instance: ExampleAltThirdPepPrescription
InstanceOf: HivAltThirdPepPrescription
Title: "Example Alternative Third PEP Prescription"
Description: "This is an example of an alternative Third PEP prescription resource based on the AltThirdPepPrescription profile."

* status = #completed
* intent = #order
* medicationCodeableConcept = HIVConcepts#HIV.C.DE103 "DRV/r"
* subject = Reference(Patient/example-hiv-patient)
* authoredOn = "2023-01-10T14:00:00Z"


21 changes: 21 additions & 0 deletions input/fsh/examples/HivPrepPrescriptions.fsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
Instance: ExamplePrepProductPrescription
InstanceOf: HivPrepProductPrescription
Title: "Example PrEP Product Prescription"
Description: "This is an example of a PREP Product Prescription resource based on the PrepProductPrescription profile."

* status = #completed
* intent = #order
* medicationCodeableConcept = HIVConcepts#HIV.C.DE81
* subject = Reference(Patient/example-hiv-patient)
* authoredOn = "2023-01-05T10:00:00Z"

Instance: ExampleCurrentPrepRegimenPrescription
InstanceOf: HivCurrentPrepRegimenPrescription
Title: "Example Current PrEP Regimen Prescription"
Description: "This is an example of a current PrEP regimen prescription resource based on the CurrentPrepRegimen profile."

* status = #completed
* intent = #order
* medicationCodeableConcept = HIVConcepts#HIV.C.DE19 "TDF"
* subject = Reference(Patient/example-hiv-patient)
* authoredOn = "2023-01-06T10:00:00Z"
10 changes: 10 additions & 0 deletions input/fsh/examples/HivStatusCondition.fsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Instance: ExampleHivPositiveCondition
InstanceOf: HivStatusCondition
Title: "Example HIV Positive Status Condition"
Description: "This is an example of an HIV Positive Status Condition resource based on the HivStatusCondition profile."

* clinicalStatus = #active
* category = http://terminology.hl7.org/CodeSystem/condition-category#encounter-diagnosis
* code = HIVConcepts#HIV.B.DE116
* subject = Reference(Patient/example-hiv-patient)
* onsetDateTime = "2023-01-15T08:30:00Z"
10 changes: 10 additions & 0 deletions input/fsh/examples/HivStatusObservation.fsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Instance: ExampleHivStatusPositiveObservation
InstanceOf: HivStatusObservation
Title: "Example HIV Positive Status Observation"
Description: "This is an example of an HIV Positive Status Observation resource based on the HivStatusObservation profile."

* status = #final
* code = HIVConcepts#HIV.B.DE115
* subject = Reference(Patient/HivExamplePatient) // Reference to a Patient resource
* effectiveDateTime = "2023-01-10T09:00:00Z" // Example effective dateTime
* valueCodeableConcept = HIVConcepts#HIV.B.DE116 "HIV-positive"
12 changes: 12 additions & 0 deletions input/fsh/examples/HivTest.fsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Instance: HivTest
InstanceOf: HivTest
Title: "Example HIV Test Observation for Positive Result"
Description: "This is an example of an HIV Test Observation resource based on the HivTest profile for a positive test result."

* status = #final
* category = http://terminology.hl7.org/CodeSystem/observation-category#laboratory
* code = HIVConcepts#HIV.B.DE81 "HIV Test"
* subject = Reference(Patient/example-hiv-patient)
* effectiveDateTime = "2023-01-01T14:30:00Z"
* issued = "2023-01-03T15:00:00Z" // Example issued time
* valueCodeableConcept = HIVConcepts#HIV.B.DE112 "HIV-positive"
11 changes: 11 additions & 0 deletions input/fsh/profiles/HivAltPepBackbonePrescription.fsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Profile: HivAltPepBackbonePrescription
Parent: MedicationRequest
Description: "A profile for MedicationRequest representing an alternative PEP backbone prescription."
* ^meta.profile[+] = "http://hl7.org/fhir/uv/crmi/StructureDefinition/crmi-shareablestructuredefinition"
* ^meta.profile[+] = "http://hl7.org/fhir/uv/crmi/StructureDefinition/crmi-publishablestructuredefinition"
* ^experimental = true
* ^title = "Alternative PEP Backbone Prescription"
* intent = #order
* medication[x] only CodeableConcept
* medicationCodeableConcept from HIV.C.DE95 (required)

11 changes: 11 additions & 0 deletions input/fsh/profiles/HivAltThirdPepPrescription.fsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Profile: HivAltThirdPepPrescription
Parent: MedicationRequest
Description: "A profile for MedicationRequest representing an alternative Third PEP drug choice prescription."
* ^meta.profile[+] = "http://hl7.org/fhir/uv/crmi/StructureDefinition/crmi-shareablestructuredefinition"
* ^meta.profile[+] = "http://hl7.org/fhir/uv/crmi/StructureDefinition/crmi-publishablestructuredefinition"
* ^experimental = true
* ^title = "Alternative Third PEP Prescription"
* intent = #order
* medication[x] only CodeableConcept
* medicationCodeableConcept from HIV.C.DE101 (required)

10 changes: 10 additions & 0 deletions input/fsh/profiles/HivCurrentPrepRegimenPrescription.fsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Profile: HivCurrentPrepRegimenPrescription
Parent: MedicationRequest
Description: "A profile for MedicationRequest representing a prescription of a current PrEP regimen."
* ^meta.profile[+] = "http://hl7.org/fhir/uv/crmi/StructureDefinition/crmi-shareablestructuredefinition"
* ^meta.profile[+] = "http://hl7.org/fhir/uv/crmi/StructureDefinition/crmi-publishablestructuredefinition"
* ^experimental = true
* ^title = "Current PrEP Regimen Prescription"
* intent = #order
* medication[x] only CodeableConcept
* medicationCodeableConcept from HIV.C.DE17 (required)
9 changes: 9 additions & 0 deletions input/fsh/profiles/HivElevatedRiskForAcquisition.fsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Profile: HivElevatedRiskForAcquisition
Parent: Condition
Description: "A condition identifying patients at elevated risk for HIV acquisition."
* ^meta.profile[+] = "http://hl7.org/fhir/uv/crmi/StructureDefinition/crmi-shareablestructuredefinition"
* ^meta.profile[+] = "http://hl7.org/fhir/uv/crmi/StructureDefinition/crmi-publishablestructuredefinition"
* ^experimental = true
* ^title = "Elevated HIV Risk Acquisition Condition"
* verificationStatus from http://hl7.org/fhir/ValueSet/condition-ver-status (required)
* code = HIVConcepts#HIV.B.DE225
11 changes: 11 additions & 0 deletions input/fsh/profiles/HivKeyPopulation.fsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Profile: HivKeyPopulation
Parent: Observation
Description: "An observation describing Patient's key population status"
* ^meta.profile[+] = "http://hl7.org/fhir/uv/crmi/StructureDefinition/crmi-shareablestructuredefinition"
* ^meta.profile[+] = "http://hl7.org/fhir/uv/crmi/StructureDefinition/crmi-publishablestructuredefinition"
* ^experimental = true
* ^title = "Patient Key Population Status"
* value[x] only CodeableConcept
* category = http://terminology.hl7.org/CodeSystem/observation-category#social-history
* valueCodeableConcept from HIV.B.DE50 (required)
* code = HIVConcepts#HIV.B.DE50
11 changes: 11 additions & 0 deletions input/fsh/profiles/HivOnArt.fsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Profile: HivOnArt
Parent: MedicationStatement
Description: "A medication statement describing a Patient's ART program"
* ^meta.profile[+] = "http://hl7.org/fhir/uv/crmi/StructureDefinition/crmi-shareablestructuredefinition"
* ^meta.profile[+] = "http://hl7.org/fhir/uv/crmi/StructureDefinition/crmi-publishablestructuredefinition"
* ^experimental = true
* ^title = "On ART Medication Statement"
* medication[x] only CodeableConcept
* medicationCodeableConcept from HIV.D.DE90 (required)
* reasonCode = HIVConcepts#HIV.D.DE38

10 changes: 10 additions & 0 deletions input/fsh/profiles/HivPatient.fsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Profile: HivPatient
Parent: Patient


// Gender
// Geographic Region
// Date of Birth



11 changes: 11 additions & 0 deletions input/fsh/profiles/HivPreferredPepBackbonePrescription.fsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@

Profile: HivPreferredPepBackbonePrescription
Parent: MedicationRequest
Description: "A profile for MedicationRequest representing a preferred PEP backbone prescription."
* ^meta.profile[+] = "http://hl7.org/fhir/uv/crmi/StructureDefinition/crmi-shareablestructuredefinition"
* ^meta.profile[+] = "http://hl7.org/fhir/uv/crmi/StructureDefinition/crmi-publishablestructuredefinition"
* ^experimental = true
* ^title = "Preferred PEP Backbone Prescription"
* intent = #order
* medication[x] only CodeableConcept
* medicationCodeableConcept from HIV.C.DE91 (required)
11 changes: 11 additions & 0 deletions input/fsh/profiles/HivPreferredThirdPepPrescription.fsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Profile: HivPreferredThirdPepPrescription
Parent: MedicationRequest
Description: "A profile for MedicationRequest representing the preferred third PEP drug choice prescription."
* ^meta.profile[+] = "http://hl7.org/fhir/uv/crmi/StructureDefinition/crmi-shareablestructuredefinition"
* ^meta.profile[+] = "http://hl7.org/fhir/uv/crmi/StructureDefinition/crmi-publishablestructuredefinition"
* ^experimental = true
* ^title = "Preferred Third PEP Prescription"
* intent = #order
* medication[x] only CodeableConcept
* medicationCodeableConcept from HIV.C.DE99 (required)

11 changes: 11 additions & 0 deletions input/fsh/profiles/HivPrepActive.fsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Profile: HivPrepActive
Parent: MedicationStatement
Description: "A medication statement describing a patient on active PrEP"
* ^meta.profile[+] = "http://hl7.org/fhir/uv/crmi/StructureDefinition/crmi-shareablestructuredefinition"
* ^meta.profile[+] = "http://hl7.org/fhir/uv/crmi/StructureDefinition/crmi-publishablestructuredefinition"
* ^experimental = true
* ^title = "HIV Prep Active"
* reasonCode = HIVConcepts#HIV.C.DE76
* medicationCodeableConcept from HIV.C.DE80 (required)


10 changes: 10 additions & 0 deletions input/fsh/profiles/HivPrepProductPrescription.fsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Profile: HivPrepProductPrescription
Parent: MedicationRequest
Description: "A profile for MedicationRequest representing a prescription of a PrEP product."
* ^meta.profile[+] = "http://hl7.org/fhir/uv/crmi/StructureDefinition/crmi-shareablestructuredefinition"
* ^meta.profile[+] = "http://hl7.org/fhir/uv/crmi/StructureDefinition/crmi-publishablestructuredefinition"
* ^experimental = true
* ^title = "PrEP Product Prescription"
* intent = #order
* medication[x] only CodeableConcept
* medicationCodeableConcept from HIV.C.DE80 (required)
10 changes: 10 additions & 0 deletions input/fsh/profiles/HivStatusCondition.fsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Profile: HivStatusCondition
Parent: Condition
Description: "A condition representing a patient's HIV status."
* ^meta.profile[+] = "http://hl7.org/fhir/uv/crmi/StructureDefinition/crmi-shareablestructuredefinition"
* ^meta.profile[+] = "http://hl7.org/fhir/uv/crmi/StructureDefinition/crmi-publishablestructuredefinition"
* ^experimental = true
* ^title = "HIV Status Condition"
* clinicalStatus from http://hl7.org/fhir/ValueSet/condition-clinical (required)
* category = http://terminology.hl7.org/CodeSystem/condition-category#encounter-diagnosis
* code from http://smart.who.int/hiv/ValueSet/HIV.B.DE115 (required)
10 changes: 10 additions & 0 deletions input/fsh/profiles/HivStatusObservation.fsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Profile: HivStatusObservation
Parent: Observation
Description: "An observation representing a patient's HIV status."
* ^meta.profile[+] = "http://hl7.org/fhir/uv/crmi/StructureDefinition/crmi-shareablestructuredefinition"
* ^meta.profile[+] = "http://hl7.org/fhir/uv/crmi/StructureDefinition/crmi-publishablestructuredefinition"
* ^experimental = true
* ^title = "HIV Status Observation"
* code = HIVConcepts#HIV.B.DE115
* value[x] only CodeableConcept
* valueCodeableConcept from http://smart.who.int/hiv/ValueSet/HIV.B.DE115 (required)
17 changes: 17 additions & 0 deletions input/fsh/profiles/HivTest.fsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Profile: HivTest
Parent: Observation
Description: "An DAK-specific HIV test observation with possible results"
* ^meta.profile[+] = "http://hl7.org/fhir/uv/crmi/StructureDefinition/crmi-shareablestructuredefinition"
* ^meta.profile[+] = "http://hl7.org/fhir/uv/crmi/StructureDefinition/crmi-publishablestructuredefinition"
* ^experimental = true
* ^title = "HIV Test"
* code = HIVConcepts#HIV.B.DE81
* category = http://terminology.hl7.org/CodeSystem/observation-category#laboratory
* value[x] only CodeableConcept
* valueCodeableConcept from HIV.B.DE111 (required)
* effective[x] ^short = "Time at which test performed"
* effective[x] only dateTime or instant
* effective[x] ^definition = "The point in time at which the test was performed"
* issued ^short = "Time at which test results returned"
* issued ^definition = "The point in time at which the test results were returned to the patient or provider"

8 changes: 8 additions & 0 deletions input/fsh/profiles/template.fsh.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Profile:
Parent:
Description: ""
* ^meta.profile[+] = "http://hl7.org/fhir/uv/crmi/StructureDefinition/crmi-shareablestructuredefinition"
* ^meta.profile[+] = "http://hl7.org/fhir/uv/crmi/StructureDefinition/crmi-publishablestructuredefinition"
* ^experimental = true
* ^title = ""

0 comments on commit 8f38792

Please sign in to comment.