WHO SMART Guidelines - HIV
0.3.0 - ci-build

WHO SMART Guidelines - HIV - Local Development build (v0.3.0) built by the FHIR (HL7® FHIR® Standard) Build Tools. See the Directory of published versions

: HIV.B2.DT Logic - XML Representation

Draft as of 2024-12-06

Raw xml | Download


<Library xmlns="http://hl7.org/fhir">
  <id value="HIVB2DTLogic"/>
  <meta>
    <profile
             value="http://hl7.org/fhir/uv/crmi/StructureDefinition/crmi-shareablelibrary"/>
    <profile
             value="http://hl7.org/fhir/uv/crmi/StructureDefinition/crmi-publishablelibrary"/>
    <profile
             value="http://hl7.org/fhir/uv/cql/StructureDefinition/cql-library"/>
    <profile
             value="http://hl7.org/fhir/uv/cql/StructureDefinition/cql-module"/>
  </meta>
  <text>
    <status value="extensions"/>
    <div xmlns="http://www.w3.org/1999/xhtml">
<div>
    <table class="grid dict">
        
        
        <tr>
            <th scope="row"><b>Title: </b></th>
            <td style="padding-left: 4px;">HIV.B2.DT Logic</td>
        </tr>
        

        
        
        <tr>
            <th scope="row"><b>Id: </b></th>
            <td style="padding-left: 4px;">HIVB2DTLogic</td>
        </tr>
        

        
        
        <tr>
            <th scope="row"><b>Version: </b></th>
            <td style="padding-left: 4px;">0.3.0</td>
        </tr>
        

        
        <tr>
            <th scope="row"><b>Url: </b></th>
            <td style="padding-left: 4px;"><a href="Library-HIVB2DTLogic.html">HIV.B2.DT Logic</a></td>
        </tr>
        

        

        

        
        <tr>
            <th scope="row"><b>Status: </b></th>
            <td style="padding-left: 4px;">draft</td>
        </tr>
        

        
        <tr>
            <th scope="row"><b>Experimental: </b></th>
            <td style="padding-left: 4px;">true</td>
        </tr>
        

        
        <tr>
            <th scope="row"><b>Type: </b></th>
            <td style="padding-left: 4px;">
                
                    
                        
                        <p style="margin-bottom: 5px;">
                            <b>system: </b> <span><a href="http://hl7.org/fhir/R4/codesystem-library-type.html">http://terminology.hl7.org/CodeSystem/library-type</a></span>
                        </p>
                        
                        
                        <p style="margin-bottom: 5px;">
                            <b>code: </b> <span>logic-library</span>
                        </p>
                        
                        
                    
                
                
            </td>
        </tr>
        

        

        
        <tr>
            <th scope="row"><b>Date: </b></th>
            <td style="padding-left: 4px;">2024-12-06 22:28:12+0000</td>
        </tr>
        

        
        <tr>
            <th scope="row"><b>Publisher: </b></th>
            <td style="padding-left: 4px;">WHO</td>
        </tr>
        

        
        <tr>
            <th scope="row"><b>Description: </b></th>
            <td style="padding-left: 4px;"><div><p>HIV.B2.DT Logic</p>
</div></td>
        </tr>
        

        

        

        

        

        

        

        

        

        

        

        

        

        

        
        
        <tr>
          <td colspan="2">
            <table>
              <tr><th><a id="cql-content"><b>Content: </b></a> text/cql</th></tr>
              <tr><td><pre><code class="language-cql">/**
Library: HIV.B2.DT Logic

@DecisionID: HIV.B2.DT
@BusinessRule: Check for signs of serious illness
@Trigger: HIV.B2 Check for signs of serious illness
@Trigger: HIV.D3 Check for signs of serious illness
@HitPolicy: Rule Order
@Description: Check for serious illness

Data Concepts:
 * HIV.A.DE17: Age | Calculated age (number of years) of the client based on date of birth
 * HIV.D.DE17: Signs of serious illness | Signs that may indicate the client has a serious illness and needs triage or an emergency referral
 * HIV.D.DE9: Body temperature | Temperature of the client in Celsius

Consolidated guidelines on HIV prevention, testing, treatment, service delivery and monitoring: recommendations for a public health approach (2021) Chapter 5: Advanced HIV Disease. Figure 5.1: Algorithm for providing a package of care for people with advanced HIV disease.
*/

library HIVB2DTLogic

using FHIR version '4.0.1'

include HIVCommon version '0.0.1' called HIC
include HIVConcepts called Concepts
include HIVEncounterElements called Elements
include FHIRHelpers version '4.0.1'

include WHOCommon called WCom

context Patient

 /*
  @input: &quot;Age 10 or older&quot;
  @pseudocode: 'Age' &gt;= 10 years
  */
define &quot;Age 10 or older&quot;:
  AgeInYearsAt(Today()) &gt;= 10

 /*
  @input: &quot;Age under 10&quot;
  @pseudocode: 'Age' &lt; 10 years
  */
define &quot;Age under 10&quot;:
  AgeInYearsAt(Today()) &lt; 10

/*
 @output: &quot;Immediately take action or refer for care if a client is having this issue&quot;
 */
define &quot;Immediately take action or refer for care if a client is having this issue&quot;:
  &quot;Age 10 or older&quot; and exists(
    Elements.&quot;Signs of serious illness Observation&quot; O
      where O.value ~ Concepts.&quot;Tachycardia&quot;
  )

/*
 @output &quot;Immediately take action or refer for care if client is showing this sign of a serious illness.&quot;
 */
define &quot;Immediately take action or refer for care if client is showing this sign of a serious illness&quot;:
  &quot;Signs of serious illness age 10 or older&quot; or &quot;Signs of serious illness age under 10&quot;

/*
 @output &quot;Use clinical judgement and consider local epidemiology to determine if symptoms suggest client is seriously ill&quot;
 */
define &quot;Use clinical judgement and consider local epidemiology to determine if symptoms suggest client is seriously ill&quot;:
  &quot;Signs of serious illness requiring clinical judgement age 10 or older&quot; or &quot;Signs of serious illness requiring clinical judgement age under 10&quot;

/*
 @dynamicValue: Guidance
 */
define &quot;Guidance&quot;:
  case 
  when &quot;Immediately take action or refer for care if a client is having this issue&quot; 
    then 'Immediately take action or refer for care if a client is having this issue.'
  when &quot;Immediately take action or refer for care if client is showing this sign of a serious illness&quot; and &quot;Age 10 or older&quot;
    then 'Immediately take action or refer for care if client is showing this sign of a serious illness.'
  when &quot;Immediately take action or refer for care if client is showing this sign of a serious illness&quot; and &quot;Age under 10&quot;
    then '''This is a sign and/or symptom of a serious health condition.
  
Immediately take action or refer for care if client is showing this sign of a serious illness.'''
  else null
  end

/*
 Supporting Logic
*/
define &quot;Signs of serious illness age 10 or older&quot;:
  &quot;Age 10 or older&quot; and exists(
    Elements.&quot;Signs of serious illness Observation&quot; O
      where
        O.value ~ Concepts.&quot;Tachypnea&quot; or
        O.value ~ Concepts.&quot;Unable to walk unaided&quot;
  )

define &quot;Signs of serious illness age under 10&quot;:
  &quot;Age under 10&quot; and exists(
    Elements.&quot;Signs of serious illness Observation&quot; O
      where
        O.value ~ Concepts.&quot;Lethargy - HIV.D.DE22&quot; or
        O.value ~ Concepts.&quot;Unconsciousness&quot; or
        O.value ~ Concepts.&quot;Convulsions&quot; or
        O.value ~ Concepts.&quot;Unable to breastfeed&quot; or
        O.value ~ Concepts.&quot;Unable to drink&quot; or
        O.value ~ Concepts.&quot;Repeated vomiting&quot;
    )

define &quot;Signs of serious illness requiring clinical judgement age 10 or older&quot;:
  &quot;Age 10 or older&quot; and exists(
    Elements.&quot;Signs of serious illness Observation&quot; O
      where
        O.value ~ Concepts.&quot;Fever of 39 C or greater&quot; or
        O.value ~ Concepts.&quot;Other sign of serious illness&quot;
  )

define &quot;Signs of serious illness requiring clinical judgement age under 10&quot;:
  &quot;Age under 10&quot; and exists(
    Elements.&quot;Signs of serious illness Observation&quot; O
      where
        O.value ~ Concepts.&quot;Fever of 39 C or greater&quot; or
        O.value ~ Concepts.&quot;Other sign of serious illness&quot;
  )
</code></pre></td></tr>
            </table>
          </td>
        </tr>
        
        
        
        
        
        <tr>
          <td colspan="2">
            <table>
              <tr><th><b>Content: </b> application/elm+xml</th></tr>
              <tr><td><pre><code/></pre></td></tr>
            </table>
          </td>
        </tr>
        
        
    </table>
</div>
</div>
  </text>
  <extension
             url="http://hl7.org/fhir/StructureDefinition/cqf-knowledgeCapability">
    <valueCode value="computable"/>
  </extension>
  <url value="http://smart.who.int/hiv/Library/HIVB2DTLogic"/>
  <version value="0.3.0"/>
  <name value="HIVB2DTLogic"/>
  <title value="HIV.B2.DT Logic"/>
  <status value="draft"/>
  <experimental value="true"/>
  <type>
    <coding>
      <system value="http://terminology.hl7.org/CodeSystem/library-type"/>
      <code value="logic-library"/>
    </coding>
  </type>
  <date value="2024-12-06T22:28:12+00:00"/>
  <publisher value="WHO"/>
  <contact>
    <name value="WHO"/>
    <telecom>
      <system value="url"/>
      <value value="http://who.int"/>
    </telecom>
  </contact>
  <description value="HIV.B2.DT Logic"/>
  <content>
    <contentType value="text/cql"/>
    <data
          value="LyoqCkxpYnJhcnk6IEhJVi5CMi5EVCBMb2dpYwoKQERlY2lzaW9uSUQ6IEhJVi5CMi5EVApAQnVzaW5lc3NSdWxlOiBDaGVjayBmb3Igc2lnbnMgb2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MzkgQyBvciBncmVhdGVyIiBvcgogICAgICAgIE8udmFsdWUgfiBDb25jZXB0cy4iT3RoZXIgc2lnbiBvZiBzZXJpb3VzIGlsbG5lc3MiCiAgKQoKZGVmaW5lICJTaWducyBvZiBzZXJpb3VzIGlsbG5lc3MgcmVxdWlyaW5nIGNsaW5pY2FsIGp1ZGdlbWVudCBhZ2UgdW5kZXIgMTAiOgogICJBZ2UgdW5kZXIgMTAiIGFuZCBleGlzdHMoCiAgICBFbGVtZW50cy4iU2lnbnMgb2Ygc2VyaW91cyBpbGxuZXNzIE9ic2VydmF0aW9uIiBPCiAgICAgIHdoZXJlCiAgICAgICAgTy52YWx1ZSB+IENvbmNlcHRzLiJGZXZlciBvZiAzOSBDIG9yIGdyZWF0ZXIiIG9yCiAgICAgICAgTy52YWx1ZSB+IENvbmNlcHRzLiJPdGhlciBzaWduIG9mIHNlcmlvdXMgaWxsbmVzcyIKICApCg=="/>
  </content>
  <content>
    <contentType value="application/elm+xml"/>
  </content>
</Library>