Versions Compared
Key
- This line was added.
- This line was removed.
- Formatting was changed.
Overview
We will move on to write two new GELLO modules. In the first we will do a simple result that returns a text message for flagging an asthmatic patient receiving too many "reliever" metered aerosol puffers in a space of time and suggesting additional 'preventer' therapy. The second will make use of the family history classes in the VMR in the diagnosis of a unilateral red eye.
Asthma example
The time has come to use a larger data file. Save the following as thirdTest.xml . Note we are adding flesh to the bones of this patient's EHR/VMR and now we have two illnesses and some medications. [The VMR allows both a problem list and a past history list. We will stick with Past History for now but we could equally be populating the problem list if we preferred.]
<?xml version="1.0" encoding="UTF-8"?>
<singlePatient xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="./iso-21090-datatypes.xsd">
<patient>
<patientID
root="1.2.36.174030967"
extension="1234567892"
reliability="VRF"
scope="OBJ"/>
<patientName>
<part type="GIV" value="Alice" />
<part type="GIV" value="A." />
<part type="FAM" value="Someone" />
</patientName>
<dob value="19550621"/>
<gender code="248152002"
codeSystem="2.16.840.1.113883.6.96"
codeSystemName="SNOMED-CT">
<displayName value = "Female" />
</gender>
<ssn value="987-65-4320"/>
<address use="WP">
<part type="AL" value="1050 W Wishard Blvd" />
<part type="CTY" value="Indianapolis" />
<part type="STA" value="IN" />
<part type="ZIP" value="46240" />
</address>
</patient>
<allergies>
<allergenType code="373873005"
codeSystem="2.16.840.1.113883.6.96"
codeSystemName="SNOMED-CT">
<displayName value = "pharmaceutical / biologic product" />
</allergenType>
<allergenCode code="111088007"
codeSystem="2.16.840.1.113883.6.96"
codeSystemName="SNOMED-CT">
<displayName value = "latex (product)" />
</allergenCode>
<allergySeverity code="24484000"
codeSystem="2.16.840.1.113883.6.96"
codeSystemName="SNOMED-CT">
<displayName value = "severe" />
</allergySeverity>
<allergyReaction code="39579001"
codeSystem="2.16.840.1.113883.6.96"
codeSystemName="SNOMED-CT">
<displayName value = "anaphylaxis" />
</allergyReaction>
<identificationDate value="1980"/>
</allergies>
<allergies>
<allergenType code="373873005"
codeSystem="2.16.840.1.113883.6.96"
codeSystemName="SNOMED-CT">
<displayName value = "pharmaceutical / biologic product" />
</allergenType>
<allergenCode code="27658006"
codeSystem="2.16.840.1.113883.6.96"
codeSystemName="SNOMED-CT">
<displayName value = "Amoxicillin" />
</allergenCode>
<allergySeverity code="24484000"
codeSystem="2.16.840.1.113883.6.96"
codeSystemName="SNOMED-CT">
<displayName value = "severe" />
</allergySeverity>
<allergyReaction code="39579001"
codeSystem="2.16.840.1.113883.6.96"
codeSystemName="SNOMED-CT">
<displayName value = "anaphylaxis" />
</allergyReaction>
<identificationDate value="1980"/>
</allergies>
<historyOfPastIllness>
<pastIllness code="302914006"
codeSystem="2.16.840.1.113883.6.96"
codeSystemName="SNOMED-CT">
<displayName value = "Barrett's esophagus" />
</pastIllness>
<temporalContext code="410587003"
codeSystem="2.16.840.1.113883.6.96"
codeSystemName="SNOMED-CT">
<displayName value = "Past - specified" />
</temporalContext>
<illnessDates>
<!--IVL_TS -->
<low value="2000" />
</illnessDates>
<notesOnIllness></notesOnIllness>
</historyOfPastIllness>
<historyOfPastIllness>
<pastIllness code="195967001"
codeSystem="2.16.840.1.113883.6.96"
codeSystemName="SNOMED-CT">
<displayName value = "Asthma" />
</pastIllness>
<temporalContext code="410587003"
codeSystem="2.16.840.1.113883.6.96"
codeSystemName="SNOMED-CT">
<displayName value = "Past - specified" />
</temporalContext>
<illnessDates>
<!--IVL_TS -->
<low value="2005" />
</illnessDates>
<notesOnIllness></notesOnIllness>
</historyOfPastIllness>
<medications>
<currentMedications>
<!--1-->
<medicationCode code="317334001"
codeSystem="2.16.840.1.113883.6.96"
codeSystemName="SNOMED-CT">
<displayName value = "Esomeprazole 40mg tablet" />
<translation code="606731"
codeSystem="2.16.840.1.113883.6.88"
codeSystemName="RxNorm">
<displayName value = "Esomeprazole 40 MG Delayed Release Oral Capsule [Nexium]" />
</translation>
</medicationCode>
<dosingSig code="229797004"
codeSystem="2.16.840.1.113883.6.96"
codeSystemName="SNOMED-CT">
<displayName value = "Once daily" />
</dosingSig>
<requestedGiveRate></requestedGiveRate><!--PQ eg 100mls an hour-->
<medicationStartDate value="20160128" />
<medicationStopdate> </medicationStopdate>
<totalDailyDose> </totalDailyDose>
<reasonForCessation> </reasonForCessation>
<indication code="302914006"
codeSystem="2.16.840.1.113883.6.96"
codeSystemName="SNOMED-CT">
<displayName value = "Barrett's esophagus" />
</indication>
<replacedBy> </replacedBy>
</currentMedications>
<!--2-->
<currentMedications>
<medicationCode code="376928006"
codeSystem="2.16.840.1.113883.6.96"
codeSystemName="SNOMED-CT">
<displayName value = "Albuterol 90mcg/inh aerosol" />
<translation code="801905"
codeSystem="2.16.840.1.113883.6.88"
codeSystemName="RxNorm">
<displayName value = "60 ACTUAT Albuterol 0.09 MG/ACTUAT Metered Dose Inhaler [Ventolin]" />
</translation>
</medicationCode>
<dosingSig code="25761000"
codeSystem="2.16.840.1.113883.6.96"
codeSystemName="SNOMED-CT">
<displayName value = "As required" />
</dosingSig>
<medicationStartDate value="20160426" />
</currentMedications>
<!--3-->
<currentMedications>
<medicationCode code="376928006"
codeSystem="2.16.840.1.113883.6.96"
codeSystemName="SNOMED-CT">
<displayName value = "Albuterol 90mcg/inh aerosol" />
<translation code="801905"
codeSystem="2.16.840.1.113883.6.88"
codeSystemName="RxNorm">
<displayName value = "60 ACTUAT Albuterol 0.09 MG/ACTUAT Metered Dose Inhaler [Ventolin]" />
</translation>
</medicationCode>
<dosingSig code="25761000"
codeSystem="2.16.840.1.113883.6.96"
codeSystemName="SNOMED-CT">
<displayName value = "As required" />
</dosingSig>
<medicationStartDate value="20160502" />
</currentMedications>
<!--4-->
<currentMedications>
<medicationCode code="376928006"
codeSystem="2.16.840.1.113883.6.96"
codeSystemName="SNOMED-CT">
<displayName value = "Albuterol 90mcg/inh aerosol" />
<translation code="801905"
codeSystem="2.16.840.1.113883.6.88"
codeSystemName="RxNorm">
<displayName value = "60 ACTUAT Albuterol 0.09 MG/ACTUAT Metered Dose Inhaler [Ventolin]" />
</translation>
</medicationCode>
<dosingSig code="25761000"
codeSystem="2.16.840.1.113883.6.96"
codeSystemName="SNOMED-CT">
<displayName value = "As required" />
</dosingSig>
<medicationStartDate value="20160516" />
</currentMedications>
</medications>
</singlePatient>
Load this data into the editor as outlined in previous tutorials. Notice the new data we have added.
Start as usual:
Context HL7_v2_VMR_V1::SinglePatient
does the patient have asthma?:
Let Asthma:CD = factory.CD_SNOMED('195967001', 'Asthma')
Let hasAsthma: Boolean = historyOfPastIllness -> exists(pastIllness.implies(Asthma).value)
[Note these two lines are subtly different to previous examples but work just as well - there is more than one way to do things - can you spot the differences?]
Look for albuterol ('reliever' puffer) scripts:
Let albuterol90_SCT:CD = factory.CD_SNOMED_CT('376928006')
Let allAbuterolScripts = medications.currentMedications->select(medicationCode.implies(albuterol90_SCT).value)
Get the medication start dates for these scripts:
Let allAlbuterolMAScriptdates: Sequence(TS) = allAbuterolScripts
->select(medicationCode.implies(albuterol90_SCT).value).medicationStartDate
Get last two dates:
Let mostRecentAlbuterolDate: TS = allAlbuterolMAScriptdates->last()
Let penultimateAlbuterolDate: TS = If mostRecentAlbuterolDate.oclIsDefined() then
allAlbuterolMAScriptdates.excluding(mostRecentAlbuterolDate)->last()
else null
endif
Get the time between them:
Let timeGap:PQ = mostRecentAlbuterolDate - penultimateAlbuterolDate
Let timeGapInDays: PQ = timeGap.convert('d')
Run the final expression that returns the message if any:
If timeGapInDays.oclIsDefined() then
If timeGapInDays < factory.PQ(21,'d') then 'Patient may be relying excessively on a reliever puffer, suggest consider addition of a preventer medication'
else ''
endif
else ''
endif