Rules

The following listing is a utility dump of all the individual rules in a Drools Package (which is the same thing as an OpenCDS Knowledge Module (KM).  Each rule is prefaced by its metadata (name, description, status), which is then followed by the source code of the rule.  The source code is shown as it would be viewed on the screen in Guvnor, with the DSLs showing the text of the selected drop-down within square brackets [like this]. 

When the rule is ultimately saved in Guvnor, the source code shown below is actually replaced by the Drools source code that is defined in the various DSLs that are applied to the source code below.

In general, due to the complexity of medical data, and the tasks that we are trying to do, the ultimate Drools source code will be difficult to read and understand.  This is why we work with DSLs, almost exclusively.  You should be able to read them, and get a pretty good idea of what they are trying to do.

Drools Rules with DSLs as a knowledge author would see them in Guvnor:

=====

Drools Rules (source showing DSLs)
Rule : A.01 InitClinicalStatementConcepts
Description: HEDIS.INITIALIZE.Sets up the Determination Method for all OpenCDS Concepts used in this KM.
Status: APPROVED
----------------------------------------------
rule "A.01 InitClinicalStatementConcepts"
    ruleflow-group "initialize"
    dialect "mvel"
    when
        Concept.Det.Clin.Stmt.Identify - Concept for ClinicalStatement is not determined according to [HEDIS 2014]
    then
        Concept.Det.Clin.Stmt.Remove - Remove ClinicalStatement concept without desired concept determination method
end


----------------------------------------------


----------------------------------------------
Rule : A.02 InitEntityConcepts
Description: HEDIS.INITIALIZE.Sets up the Determination Method for all OpenCDS Concepts used in this KM.
Status: APPROVED
----------------------------------------------
rule "A.02 InitEntityConcepts"
    ruleflow-group "initialize"
    dialect "mvel"
    when
        Concept.Det.Entity.Identify - Concept for Entities is not determined according to [HEDIS 2014]
    then
        Concept.Det.Entity.Remove - Remove Entities concept without desired concept determination method
end


----------------------------------------------


----------------------------------------------
Rule : A.03 InitRelationshipConcepts
Description: HEDIS.INITIALIZE.Sets up the Determination Method for all OpenCDS Concepts used in this KM.
Status: APPROVED
----------------------------------------------
rule "A.03 InitRelationshipConcepts"
    ruleflow-group "initialize"
    dialect "mvel"
    when
        Concept.Det.Rship.Identify - Concept for Relationship is not determined according to [OpenCDS]
    then
        Concept.Det.Rship.Remove - Remove Relationship concept without desired concept determination method
end


----------------------------------------------


----------------------------------------------
Rule : A.04 Response_Wrapper
Description: HEDIS.INITIALIZE.adds a string 'wrapper'
Status: APPROVED
----------------------------------------------
rule "A.04 Response_Wrapper"
    dialect "java"
    ruleflow-group "initialize"
    when
        Init.EvalTime.FpId.EvalpId - Note that all criteria below must be met for the rule to fire.
        EvaluatedPerson( )
        not (
        Assertion.String.Exists - There is an Assertion String [wrapper]
        )
    then
  
      Out.Root.Obs.Focus.EvalpId - Create root output observation with 
ID [ROOT] focused on [QM HEDIS-URI Tx for Children with URI] with value 
identifying the evaluatedPerson
        Assert.String - Assert String [wrapper] for both Rules and Process
end


----------------------------------------------


----------------------------------------------
Rule : C.01 MissingDateOfBirth
Description: USING:Missing date of birth
Status: APPROVED
----------------------------------------------
rule "C.01 MissingDateOfBirth"
    ruleflow-group "checkBadData"
    dialect "java"
    when
        Init.EvalTime.FpId.EvalpId - Note that all criteria below must be met for the rule to fire.
        // This rule depends on the submission of all relevant data
        // for exactly one encounter for one patient at a time.
        Missing.DOB - EvaluatedPerson is missing date of birth
    then
        Assert - Assert to both Rules and Process that [Missing Data for Date of Birth]
        Assert - Assert to both Rules and Process that [Rejected for Missing or Bad Data]
end


----------------------------------------------


----------------------------------------------
Rule : E.01 Response_Reject
Description:
Status: APPROVED
----------------------------------------------
rule "E.01 Response_Reject"
    dialect "java"
    ruleflow-group "reject"
    when
        Init.EvalTime.FpId.EvalpId - Note that all criteria below must be met for the rule to fire.
    then
  
      Out.Nested.Obs.Num.Denom - Create numerator value [0] as ID 
[numerator] and denominator value [0] as ID [denominator] for output 
observations focused on [Rejected for Missing or Bad Data] within 
enclosing observation ID [ROOT]
        Assert.String - Assert String [reject] for both Rules and Process
        Out.Assertions - Create output observation with ID [ASSERTROOT] containing a list of all assertions in working memory
end


----------------------------------------------


----------------------------------------------
Rule : G.01 IncludeAgeGE21LT234Months
Description: HEDIS.DENOM.USING:include if age GE 18 years and LT 65 years
Status: DRAFT
----------------------------------------------
rule "G.01 IncludeAgeGE21LT234Months"
    ruleflow-group "denominatorInclusions"
    dialect "java"
    when
        Init.EvalTime.FpId.EvalpId - Note that all criteria below must be met for the rule to fire.
  
      Dem.Age.Time - Evaluated Person age was [=]  [3]  [month(s)] at 
[18]  [month(s)]  [+]  [0]  [day(s)] before evalTime, where time 
components are ignored if age unit is year, month, or day
       
 Dem.Age.Time - Evaluated Person age was [<]  [19]  [year(s)] at [6] 
 [month(s)]  [+]  [1]  [year(s)] before evalTime, where time components 
are ignored if age unit is year, month, or day
    then
        Assert - Assert to both Rules and Process that [Patient Age GE 21 LT 234 Months]
end


----------------------------------------------


----------------------------------------------
Rule : G.02 ListURIOutpatientEncounters
Description: HEDIS.DENOM.USING:include outpatient Acute Bronchitis encounters
Status: DRAFT
----------------------------------------------
rule "G.02 ListURIOutpatientEncounters"
    ruleflow-group "denominatorInclusions"
    dialect "java"
    when
        Init.EvalTime.FpId.EvalpId - Note that all criteria below must be met for the rule to fire.
  
      Enc.Rship.EncDx.Between.Times.Count.Id - Evaluated Person had at 
least [0]  [Enc List A]  [HEDIS-Outpatient] with [low] time at most 
[18]  [month(s)] and more than [6]  [month(s)] ago where [HEDIS-URI] was
 [Part of] the encounter
    then
       
 Insert.EncListRef.As.NamedList - Insert [Enc List A] as Named List 
"[URIOutpatientEncounters]" for both Rules and Process
end


----------------------------------------------


----------------------------------------------
Rule : G.03 ListURIObservationEncounters
Description: HEDIS.DENOM.USING:include outpatient Acute Bronchitis encounters
Status: DRAFT
----------------------------------------------
rule "G.03 ListURIObservationEncounters"
    ruleflow-group "denominatorInclusions"
    dialect "java"
    when
        Init.EvalTime.FpId.EvalpId - Note that all criteria below must be met for the rule to fire.
  
      Enc.Rship.EncDx.Between.Times.Count.Id - Evaluated Person had at 
least [0]  [Enc List A]  [HEDIS-Observation] with [low] time at most 
[18]  [month(s)] and more than [6]  [month(s)] ago where [HEDIS-URI] was
 [Part of] the encounter
    then
       
 Insert.EncListRef.As.NamedList - Insert [Enc List A] as Named List 
"[URIObservationEncounters]" for both Rules and Process
end


----------------------------------------------


----------------------------------------------
Rule : G.04 ListURIEDEncounters
Description: HEDIS.DENOM.USING:include ED Acute Bronchitis encounters
Status: DRAFT
----------------------------------------------
rule "G.04 ListURIEDEncounters"
    ruleflow-group "denominatorInclusions"
    dialect "java"
    when
        Init.EvalTime.FpId.EvalpId - Note that all criteria below must be met for the rule to fire.
  
      Enc.Rship.EncDx.Between.Times.Count.Id - Evaluated Person had at 
least [0]  [Enc List A]  [HEDIS-ED] with [low] time at most [18]  
[month(s)] and more than [6]  [month(s)] ago where [HEDIS-URI] was [Part
 of] the encounter
    then
        Insert.EncListRef.As.NamedList - Insert [Enc List A] as Named List "[URIEDEncounters]" for both Rules and Process
end


----------------------------------------------


----------------------------------------------
Rule : G.05 ListAcuteInpatientEncounters
Description: HEDIS.DENOM.USING:include AcuteInpatientEncounters
Status: DRAFT
----------------------------------------------
rule "G.05 ListAcuteInpatientEncounters"
    ruleflow-group "denominatorInclusions"
    dialect "java"
    when
        Init.EvalTime.FpId.EvalpId - Note that all criteria below must be met for the rule to fire.
  
      Enc.Between.Times.Count.Id - Evaluated Person had at least [0]  
[Enc List A]  [HEDIS-Acute Inpatient] with [low] time at most [18]  
[month(s)] and more than [6]  [month(s)] ago
    then
      
  Insert.EncListRef.As.NamedList - Insert [Enc List A] as Named List 
"[AcuteInpatientEncounters]" for both Rules and Process
end


----------------------------------------------


----------------------------------------------
Rule : G.06 ListNonAcuteInpatientEncounters
Description: HEDIS.DENOM.USING:include NonAcuteInpatientEncounters
Status: DRAFT
----------------------------------------------
rule "G.06 ListNonAcuteInpatientEncounters"
    ruleflow-group "denominatorInclusions"
    dialect "java"
    when
        Init.EvalTime.FpId.EvalpId - Note that all criteria below must be met for the rule to fire.
  
      Enc.Between.Times.Count.Id - Evaluated Person had at least [0]  
[Enc List A]  [HEDIS-Nonacute Inpatient] with [low] time at most [18]  
[month(s)] and more than [6]  [month(s)] ago
    then
      
  Insert.EncListRef.As.NamedList - Insert [Enc List A] as Named List 
"[NonAcuteInpatientEncounters]" for both Rules and Process
end


----------------------------------------------


----------------------------------------------
Rule : G.07 ListURIEncounters
Description: HEDIS.DENOM.USING:include if age GE 19 years and LE 51 years
Status: DRAFT
----------------------------------------------
rule "G.07 ListURIEncounters"
    ruleflow-group "denominatorInclusions"
    dialect "java"
    when
        Init.EvalTime.FpId.EvalpId - Note that all criteria below must be met for the rule to fire.
        NamedList.Exists.EncListId - The Named List [Enc List A]  [URIOutpatientEncounters] exists; may be empty
        NamedList.Exists.EncListId - The Named List [Enc List B]  [URIObservationEncounters] exists; may be empty
        NamedList.Exists.EncListId - The Named List [Enc List C]  [URIEDEncounters] exists; may be empty
        NamedList.Exists.EncListId - The Named List [Enc List D]  [AcuteInpatientEncounters] exists; may be empty
        NamedList.Exists.EncListId - The Named List [Enc List E]  [NonAcuteInpatientEncounters] exists; may be empty
    then
  
      Set.EncListId.EncListRefs.No.Time.Overlap - Set [Enc List F] as 
the encounters in [Enc List C] with no time overlap with [Enc List D]
  
      Set.EncListId.EncListRefs.No.Time.Overlap - Set [Enc List G] as 
the encounters in [Enc List F] with no time overlap with [Enc List E]
        Set.EncListId.Add.EncListRefs - Set [Enc List H] as [Enc List A] added to [Enc List B]
        Set.EncListId.Add.EncListRefs - Set [Enc List I] as [Enc List G] added to [Enc List H]
        Insert.EncListRef.As.NamedList - Insert [Enc List I] as Named List "[URIEncounters]" for both Rules and Process
end


----------------------------------------------


----------------------------------------------
Rule : G.08 HasDenominatorInclusions
Description: HEDIS.DENOM.USING: Include in measure population
Status: DRAFT
----------------------------------------------
rule "G.08 HasDenominatorInclusions"
    ruleflow-group "denominatorInclusions"
    dialect "java"
    when
        Init.EvalTime.FpId.EvalpId - Note that all criteria below must be met for the rule to fire.
        Assertion.Exists - There is assertion [Patient Age GE 21 LT 234 Months]
        NamedList.Exists.Not.Empty - The Named List [URIEncounters] exists and is not empty
    then
        Assert - Assert to both Rules and Process that [Denominator Inclusions Met]
end


----------------------------------------------


----------------------------------------------
Rule : I.01 ExcludeMultipleClaims
Description: HEDIS.DENOM.USING: Exclude from measure population
Status: APPROVED
----------------------------------------------
rule "I.01 ExcludeMultipleClaims"
    ruleflow-group "denominatorExclusions"
    dialect "java"
    when
        Init.EvalTime.FpId.EvalpId - Note that all criteria below must be met for the rule to fire.
        Assertion.Exists - There is assertion [Denominator Inclusions Met]
        not (
        NamedList.Exists.EncListId - The Named List [Enc List A]  [MultipleClaims] exists; may be empty
        )
  
      Enc.From.NamedList.Rship.EncDx.Not.Multiple.Count.Id - Evaluated 
Person had at least [0]  [Enc List B] from Named List "[URIEncounters]" 
 with more than [0] not a [HEDIS-URI] Encounter Diagnoses as [Part of] 
the encounter
    then
        Insert.EncListRef.As.NamedList - Insert [Enc List B] as Named List "[MultipleClaims]" for both Rules and Process
end


----------------------------------------------


----------------------------------------------
Rule : I.02 ExcludeMedicationActive
Description: HEDIS.DENOM.USING: Exclude from measure population
Status: APPROVED
----------------------------------------------
rule "I.02 ExcludeMedicationActive"
    ruleflow-group "denominatorExclusions"
    dialect "java"
    when
        Init.EvalTime.FpId.EvalpId - Note that all criteria below must be met for the rule to fire.
        Assertion.Exists - There is assertion [Denominator Inclusions Met]
        not (
        NamedList.Exists.EncListId - The Named List [Enc List A]  [MedicationActive] exists; may be empty
        )
  
     
 Enc.From.NamedList.After.Med.SubDispense.DaysSupply.Active.Count.Id - 
Evaluated Person had at least [0]  [Enc List B] from Named List 
"[URIEncounters]" where low time was at most [0]  [day(s)] after low 
time of [HEDIS-CWP Table C Antibiotic Medications] dispensation plus 
Days Supply
    then
        Insert.EncListRef.As.NamedList - Insert [Enc List B] as Named List "[MedicationActive]" for both Rules and Process
end


----------------------------------------------


----------------------------------------------
Rule : I.03 ExcludeMedicationDispensed
Description: HEDIS.DENOM.USING: Exclude from measure population
Status: APPROVED
----------------------------------------------
rule "I.03 ExcludeMedicationDispensed"
    ruleflow-group "denominatorExclusions"
    dialect "java"
    when
        Init.EvalTime.FpId.EvalpId - Note that all criteria below must be met for the rule to fire.
        Assertion.Exists - There is assertion [Denominator Inclusions Met]
        not (
        NamedList.Exists.EncListId - The Named List [Enc List A]  [MedicationDispensed] exists; may be empty
        )
  
      Enc.From.NamedList.After.Med.SubDispense.Count.Id - Evaluated 
Person had at least [0]  [Enc List B] from Named List "[URIEncounters]" 
where low time was at most [30]  [day(s)] after low time of [HEDIS-CWP 
Table C Antibiotic Medications] dispensation
    then
        Insert.EncListRef.As.NamedList - Insert [Enc List B] as Named List "[MedicationDispensed]" for both Rules and Process
end


----------------------------------------------


----------------------------------------------
Rule : I.04 ExcludePharyngitisCompetingDx
Description: HEDIS.DENOM.USING: Exclude from measure population
Status: APPROVED
----------------------------------------------
rule "I.04 ExcludePharyngitisCompetingDx"
    ruleflow-group "denominatorExclusions"
    dialect "java"
    when
        Init.EvalTime.FpId.EvalpId - Note that all criteria below must be met for the rule to fire.
        Assertion.Exists - There is assertion [Denominator Inclusions Met]
        not (
        NamedList.Exists.EncListId - The Named List [Enc List A]  [PharyngitisCompetingDx] exists; may be empty
        )
  
      Enc.From.NamedList.Before.After.Enc.Rship.EncDx.Count.Id - 
Evaluated Person had at least [0]  [Enc List B] from Named List 
"[URIEncounters]" where low time was at most [30]  [day(s)] after 
encounter high time AND high time was at most [8]  [day(s)] before 
encounter low time where [HEDIS-Pharyngitis] was [Part of] the encounter
    then
        Insert.EncListRef.As.NamedList - Insert [Enc List B] as Named List "[PharyngitisCompetingDx]" for both Rules and Process
end


----------------------------------------------


----------------------------------------------
Rule : I.05 ExcludeOtherCompetingDx
Description: HEDIS.DENOM.USING: Exclude from measure population
Status: APPROVED
----------------------------------------------
rule "I.05 ExcludeOtherCompetingDx"
    ruleflow-group "denominatorExclusions"
    dialect "java"
    when
        Init.EvalTime.FpId.EvalpId - Note that all criteria below must be met for the rule to fire.
        Assertion.Exists - There is assertion [Denominator Inclusions Met]
        not (
        NamedList.Exists.EncListId - The Named List [Enc List A]  [OtherCompetingDx] exists; may be empty
        )
  
      Enc.From.NamedList.Before.After.Enc.Rship.EncDx.Count.Id - 
Evaluated Person had at least [0]  [Enc List B] from Named List 
"[URIEncounters]" where low time was at most [30]  [day(s)] after 
encounter high time AND high time was at most [8]  [day(s)] before 
encounter low time where [HEDIS-Competing Diagnosis] was [Part of] the 
encounter
    then
        Insert.EncListRef.As.NamedList - Insert [Enc List B] as Named List "[OtherCompetingDx]" for both Rules and Process
end


----------------------------------------------


----------------------------------------------
Rule : I.06 ListAllExclusions
Description: HEDIS.DENOM.USING:include if age GE 19 years and LE 51 years
Status: DRAFT
----------------------------------------------
rule "I.06 ListAllExclusions"
    ruleflow-group "denominatorExclusions"
    dialect "java"
    when
        Init.EvalTime.FpId.EvalpId - Note that all criteria below must be met for the rule to fire.
        Assertion.Exists - There is assertion [Denominator Inclusions Met]
        not (
        NamedList.Exists.EncListId - The Named List [Enc List A]  [AllExclusions] exists; may be empty
        )
        NamedList.Exists.EncListId - The Named List [Enc List B]  [MultipleClaims] exists; may be empty
        NamedList.Exists.EncListId - The Named List [Enc List C]  [MedicationActive] exists; may be empty
        NamedList.Exists.EncListId - The Named List [Enc List D]  [MedicationDispensed] exists; may be empty
        NamedList.Exists.EncListId - The Named List [Enc List E]  [PharyngitisCompetingDx] exists; may be empty
        NamedList.Exists.EncListId - The Named List [Enc List F]  [OtherCompetingDx] exists; may be empty
    then
        Set.EncListId.Add.EncListRefs - Set [Enc List G] as [Enc List B] added to [Enc List C]
        Set.EncListId.Add.EncListRefs - Set [Enc List H] as [Enc List D] added to [Enc List E]
        Set.EncListId.Add.EncListRefs - Set [Enc List I] as [Enc List F] added to [Enc List G]
        Set.EncListId.Add.EncListRefs - Set [Enc List J] as [Enc List I] added to [Enc List H]
        Insert.EncListRef.As.NamedList - Insert [Enc List J] as Named List "[AllExclusions]" for both Rules and Process
end


----------------------------------------------


----------------------------------------------
Rule : I.07 ListEligibleEncounters
Description: HEDIS.DENOM.USING:include if age GE 19 years and LE 51 years
Status: DRAFT
----------------------------------------------
rule "I.07 ListEligibleEncounters"
    ruleflow-group "denominatorExclusions"
    dialect "java"
    when
        Init.EvalTime.FpId.EvalpId - Note that all criteria below must be met for the rule to fire.
        Assertion.Exists - There is assertion [Denominator Inclusions Met]
        not (
        NamedEnc.Exists.Not.Null - The Named Encounter [EligibleEncounters] exists and is not null
        )
        NamedList.Exists.EncListId - The Named List [Enc List A]  [URIEncounters] exists; may be empty
        NamedList.Exists.EncListId - The Named List [Enc List B]  [AllExclusions] exists; may be empty
    then
  
      Set.EncListId.EncListRefs.No.Time.Overlap - Set [Enc List C] as 
the encounters in [Enc List A] with no time overlap with [Enc List B]
        Insert.EncListRef.As.NamedList - Insert [Enc List C] as Named List "[EligibleEncounters]" for both Rules and Process
end


----------------------------------------------


----------------------------------------------
Rule : K.01 DenominatorCriteriaMet
Description: HEDIS.DENOM.USING: Include in measure population
Status: APPROVED
----------------------------------------------
rule "K.01 DenominatorCriteriaMet"
    ruleflow-group "denominatorConclusion"
    dialect "java"
    when
        Init.EvalTime.FpId.EvalpId - Note that all criteria below must be met for the rule to fire.
        Assertion.Exists - There is assertion [Denominator Inclusions Met]
        Assertion.Not.Exists - There is NOT an assertion [Denominator Exclusions Met]
        NamedList.Exists.Not.Empty - The Named List [EligibleEncounters] exists and is not empty
        not (
        NamedDate.Exists.Not.Null - The Named Date [IESD] exists and is not null
        )
    then
        Assert - Assert to both Rules and Process that [Denominator Criteria Met]
  
      Insert.NamedDate.From.Earliest.Enc.In.NamedList - Insert Named 
Date "[IESD]" for both Rules and Process which is the earliest encounter
 [low] time in [EligibleEncounters]; requires NamedList.Exists.Not.Empty
end


----------------------------------------------


----------------------------------------------
Rule : K.02  InsertNamedDateIESD_ PLUS_3D
Description: HEDIS.DENOM.USING: Include in measure population
Status: APPROVED
----------------------------------------------
rule "K.02  InsertNamedDateIESD_ PLUS_3D"
    ruleflow-group "denominatorConclusion"
    dialect "java"
    when
        Init.EvalTime.FpId.EvalpId - Note that all criteria below must be met for the rule to fire.
        Assertion.Exists - There is assertion [Denominator Criteria Met]
        NamedDate.Exists.Not.Null - The Named Date [IESD] exists and is not null
        not (
        NamedDate.Exists.Not.Null - The Named Date [IESD_PLUS_3D] exists and is not null
        )
    then
  
      Insert.NamedDate.After.NamedDate - Insert Named Date 
"[IESD_PLUS_3D]" for both Rules and Process which is [3]  [day(s)] after
 [IESD]; requires NamedDate.Exists.Not.Null
        Assert.NamedDate - Assert name and value for Named Date [IESD] for both Rules and Process
end


----------------------------------------------


----------------------------------------------
Rule : N.01 Num_AntibioticMedication
Description: AWC.NUM.numerator for Well-Care Visit
Status: DRAFT
----------------------------------------------
rule "N.01 Num_AntibioticMedication"
    ruleflow-group "numerator"
    dialect "java"
    when
        Init.EvalTime.FpId.EvalpId - Note that all criteria below must be met for the rule to fire.
        Assertion.Exists - There is assertion [Denominator Criteria Met]
  
      SubDispense.Med.Between.NamedDates.NoTimes - Evaluated Person had 
[HEDIS-CWP Table C Antibiotic Medications] with [high] dispensation time
 [=]  [IESD] and [<=]  [IESD_PLUS_3D] ignoring time components of all
 dates
    then
        Assert - Assert to both Rules and Process that [Antibiotic]
        Assert - Assert to both Rules and Process that [Numerator Criteria Met]
end


----------------------------------------------


----------------------------------------------
Rule : S.01 DebugConceptsAll
Description: DEBUG temporary, creates output of all mapped concepts (not just ones for a particular determination method)
Status: APPROVED
----------------------------------------------
rule "S.01 DebugConceptsAll"
    dialect "java"
    ruleflow-group "debug"
    when
        Init.EvalTime.FpId.EvalpId - Note that all criteria below must be met for the rule to fire.
        Out.Concepts.All.Read - All OpenCDS Concepts have been mapped to the vMR data
    then
  
      Out.Concepts.All.Write - Create output observation with ID 
[DEBUG_CONCEPTS] containing all OpenCDS Concepts in working memory 
selected above
end


----------------------------------------------


----------------------------------------------
Rule : T.01 Response_DenomNotMet
Description:
Status: APPROVED
----------------------------------------------
rule "T.01 Response_DenomNotMet"
    dialect "java"
    ruleflow-group "denomNotMet"
    when
        Init.EvalTime.FpId.EvalpId - Note that all criteria below must be met for the rule to fire.
    then
  
      Out.Nested.Obs.Num.Denom - Create numerator value [0] as ID 
[numerator] and denominator value [0] as ID [denominator] for output 
observations focused on [QM HEDIS-URI Tx for Children with URI] within 
enclosing observation ID [ROOT]
        Assert.String - Assert String [denomNotMet] for both Rules and Process
        Out.Assertions - Create output observation with ID [ASSERTROOT] containing a list of all assertions in working memory
end


----------------------------------------------


----------------------------------------------
Rule : U.01 Response_NumNotMet
Description:
Status: APPROVED
----------------------------------------------
rule "U.01 Response_NumNotMet"
    dialect "java"
    ruleflow-group "numNotMet"
    when
        Init.EvalTime.FpId.EvalpId - Note that all criteria below must be met for the rule to fire.
    then
  
      Out.Nested.Obs.Num.Denom - Create numerator value [0] as ID 
[numerator] and denominator value [1] as ID [denominator] for output 
observations focused on [QM HEDIS-URI Tx for Children with URI] within 
enclosing observation ID [ROOT]
        Assert.String - Assert String [numNotMet] for both Rules and Process
        Out.Assertions - Create output observation with ID [ASSERTROOT] containing a list of all assertions in working memory
end


----------------------------------------------


----------------------------------------------
Rule : W.01 Response_NumDenomMet
Description:
Status: APPROVED
----------------------------------------------
rule "W.01 Response_NumDenomMet"
    dialect "java"
    ruleflow-group "numMet"
    when
        Init.EvalTime.FpId.EvalpId - Note that all criteria below must be met for the rule to fire.
    then
  
      Out.Nested.Obs.Num.Denom - Create numerator value [1] as ID 
[numerator] and denominator value [1] as ID [denominator] for output 
observations focused on [QM HEDIS-URI Tx for Children with URI] within 
enclosing observation ID [ROOT]
        Assert.String - Assert String [numMet] for both Rules and Process
        Out.Assertions - Create output observation with ID [ASSERTROOT] containing a list of all assertions in working memory
end


----------------------------------------------


Concepts used:
INPUT
    1 -> year(s)
    2 -> month(s)
    5 -> day(s)
    C2511 -> HEDIS 2014
    C2847 -> HEDIS-CWP Table C Antibiotic Medications
    C2964 -> HEDIS-Outpatient
    C2968 -> HEDIS-ED
    C2971 -> HEDIS-Acute Inpatient
    C3020 -> HEDIS-Nonacute Inpatient
    C3022 -> HEDIS-Observation
    C3093 -> HEDIS-Competing Diagnosis
    C3141 -> HEDIS-Pharyngitis
    C3151 -> HEDIS-URI
    C3216 -> Patient Age GE 21 LT 234 Months
    C36 -> OpenCDS
    C405 -> Part of
    C54 -> Denominator Criteria Met
    C544 -> Denominator Exclusions Met
    C545 -> Denominator Inclusions Met
OUTPUT
    5 -> day(s)
    C1527 -> Antibiotic
    C2605 -> QM HEDIS-URI Tx for Children with URI
    C3216 -> Patient Age GE 21 LT 234 Months
    C529 -> Rejected for Missing or Bad Data
    C539 -> Numerator Criteria Met
    C54 -> Denominator Criteria Met
    C545 -> Denominator Inclusions Met
    C569 -> Missing Data for Date of Birth






Compiled Rules (Drools source code after DSLs are evaluated):

=====

Drools Rules (Source after DSLs Applied)
rule "A.01 InitClinicalStatementConcepts"
	ruleflow-group "initialize"
	dialect "mvel"
	when
		( $ConceptDeterminationMethodClinicalStatementConceptToRemoveC2511 : 
			VmrOpenCdsConcept (
				determinationMethodCode != "C2511"
			) and  
			ClinicalStatement 	(
				id == $ConceptDeterminationMethodClinicalStatementConceptToRemoveC2511.conceptTargetId
			)
		) //DslUsed==Concept.Det.Clin.Stmt.Identify|||DETERMETHOD==C2511
	then
		retract ($ConceptDeterminationMethodClinicalStatementConceptToRemoveC2511); 
//DslUsed==Concept.Det.Clin.Stmt.Remove.Dsl|||DETERMETHOD==C2511
end


rule "A.02 InitEntityConcepts"
	ruleflow-group "initialize"
	dialect "mvel"
	when
		( $ConceptDeterminationMethodEntityConceptToRemoveC2511 : 
			VmrOpenCdsConcept (
				determinationMethodCode != "C2511"
			) and
			EntityBase 	(
			 	id == $ConceptDeterminationMethodEntityConceptToRemoveC2511.conceptTargetId
			)
		) //DslUsed==Concept.Det.Entity.Identify.Dsl|||DETERMETHOD==C2511
	then
		retract ($ConceptDeterminationMethodEntityConceptToRemoveC2511); 
//DslUsed==Concept.Det.Entity.Remove.Dsl|||DETERMETHOD==C2511
end


rule "A.03 InitRelationshipConcepts"
	ruleflow-group "initialize"
	dialect "mvel"
	when
		( $ConceptDeterminationMethodRelationshipConceptToRemoveC36 : 
			VmrOpenCdsConcept (
				determinationMethodCode != "C36" 	
			) and
			(  	
			ClinicalStatementRelationship 		(
		 		id == $ConceptDeterminationMethodRelationshipConceptToRemoveC36.conceptTargetId
				) or 	 	
			EntityRelationship 		(
				id == $ConceptDeterminationMethodRelationshipConceptToRemoveC36.conceptTargetId 
				)
		  	)
		) //DslUsed==Concept.Det.Rship.Identify.Dsl|||DETERMETHOD==C36
	then
		retract ($ConceptDeterminationMethodRelationshipConceptToRemoveC36); 
//DslUsed==Concept.Det.Rship.Remove.Dsl|||DETERMETHOD==C36
end


rule "A.04 Response_Wrapper"
	dialect "java"
	ruleflow-group "initialize"
	when
		( EvalTime($evalTime : evalTimeValue) and 
			FocalPersonId($focalPersonId : id) and 
				FocalPersonId($evaluatedPersonId : id) )
		 EvaluatedPerson( )
		 not (
		( 	Assertion 	( 		value == "wrapper" 	) ) //DslUsed==Assertion.String.Exists|||ASSERTIONSTRING==wrapper
		 )
	then
ObservationResult parentObsROOT = new ObservationResult(); 
String parentObsROOTId = "2.16.840.1.113883.3.795.5.1.1^ROOT"; 
CD parentObsROOTFocus = new CD(); 
parentObsROOTFocus.setCodeSystem("2.16.840.1.113883.3.795.12.1.1"); 
parentObsROOTFocus.setCodeSystemName("OpenCDS concepts"); 
parentObsROOTFocus.setCode("C2605"); 
parentObsROOTFocus.setDisplayName(getOpenCDSConceptName("C2605")); 
ObservationValue parentObsROOTValue = new ObservationValue(); 
String parentObsROOTIdentifier = $evaluatedPersonId; 
parentObsROOTValue.setIdentifier(parentObsROOTIdentifier); 
IVLDate obsTimeROOT = new IVLDate(); 
obsTimeROOT.setLow($evalTime); 
obsTimeROOT.setHigh($evalTime); 
parentObsROOT.setId(parentObsROOTId); 
parentObsROOT.setObservationFocus(parentObsROOTFocus); 
parentObsROOT.setObservationValue(parentObsROOTValue); 
parentObsROOT.setObservationEventTime(obsTimeROOT); 
parentObsROOT.setEvaluatedPersonId($evaluatedPersonId); 
parentObsROOT.setSubjectIsFocalPerson($evaluatedPersonId == $focalPersonId); 
parentObsROOT.setClinicalStatementToBeRoot(true); 
parentObsROOT.setToBeReturned(true); 
insert(parentObsROOT); 
namedObjects.put("parentObsROOT", parentObsROOT); 
//DslUsed==Out.Root.Obs.Focus.EvalpId.Dsl|||ROOT==ROOT|||OUTROOTFOCUS==C2605
assertions.add("wrapper"); 

insert(new Assertion("wrapper")); 
//DslUsed==Assert.String.Dsl|||ASSERTIONSTRING==wrapper
end


rule "C.01 MissingDateOfBirth"
	ruleflow-group "checkBadData"
	dialect "java"
	when
		( EvalTime($evalTime : evalTimeValue) and 
			FocalPersonId($focalPersonId : id) and 
				FocalPersonId($evaluatedPersonId : id) )
		 // This rule depends on the submission of all relevant data 
		 // for exactly one encounter for one patient at a time.
		(   (EvaluatedPerson(id == $evaluatedPersonId, demographics == null))  
			or   
			(EvaluatedPerson(id == $evaluatedPersonId, demographics.birthTime == null)) )
	then
		insert(new Assertion("C569")); 

assertions.add("C569"); 

//DslUsed==Assert.Dsl|||ASSERTION==C569
		insert(new Assertion("C529")); 

assertions.add("C529"); 

//DslUsed==Assert.Dsl|||ASSERTION==C529
end


rule "E.01 Response_Reject"
	dialect "java"
	ruleflow-group "reject"
	when
		( EvalTime($evalTime : evalTimeValue) and 
			FocalPersonId($focalPersonId : id) and 
			FocalPersonId($evaluatedPersonId : id) )
	then
		IVLDate obsTimenumerator = new IVLDate(); 

 obsTimenumerator.setLow($evalTime); 
 obsTimenumerator.setHigh($evalTime); 
 ObservationResult childObsnumerator = new ObservationResult(); 
 String childObsnumeratorId = "2.16.840.1.113883.3.795.5.1.1^numerator"; 
 childObsnumerator.setId(childObsnumeratorId); 
 childObsnumerator.setEvaluatedPersonId($evaluatedPersonId); 
 childObsnumerator.setObservationEventTime(obsTimenumerator); 
 childObsnumerator.setSubjectIsFocalPerson($evaluatedPersonId == $focalPersonId); 
 childObsnumerator.setClinicalStatementToBeRoot(false); 
 childObsnumerator.setToBeReturned(true); 
 CD childObsnumeratorFocus = new CD(); 
 childObsnumeratorFocus.setCodeSystem("2.16.840.1.113883.3.795.12.1.1"); 
 childObsnumeratorFocus.setCodeSystemName("OpenCDS concepts"); 
 childObsnumeratorFocus.setCode("C529"); 
 childObsnumeratorFocus.setDisplayName(getOpenCDSConceptName("C529")); 
 childObsnumerator.setObservationFocus(childObsnumeratorFocus); 
 int iChildObsnumerator = 0; 
 INT childObsnumeratorIntegerValue = new INT(); 
 childObsnumeratorIntegerValue.setValue(iChildObsnumerator); 
 ObservationValue childObsnumeratorValue = new ObservationValue(); 
 childObsnumeratorValue.setInteger(childObsnumeratorIntegerValue); 
 childObsnumerator.setObservationValue(childObsnumeratorValue); 
 ClinicalStatementRelationship relnumerator = new ClinicalStatementRelationship(); 
 relnumerator.setSourceId("2.16.840.1.113883.3.795.5.1.1^ROOT"); 
 relnumerator.setTargetId("2.16.840.1.113883.3.795.5.1.1^numerator"); 
 CD relnumeratorCode = new CD(); 
 relnumeratorCode.setCodeSystem("2.16.840.1.113883.3.795.12.1.1"); 
 relnumeratorCode.setCodeSystemName("OpenCDS concepts"); 
 relnumeratorCode.setCode("C405"); 
 relnumeratorCode.setDisplayName("Part of"); 
 relnumerator.setTargetRelationshipToSource(relnumeratorCode); 
 java.util.List<RelationshipToSource> childObsnumeratorRelationshipToSources = 
	 new java.util.ArrayList<RelationshipToSource>(); 
 RelationshipToSource childObsnumeratorRelationshipToSource = new RelationshipToSource(); 
 childObsnumeratorRelationshipToSource.setSourceId("2.16.840.1.113883.3.795.5.1.1^ROOT"); 
 childObsnumeratorRelationshipToSource.setRelationshipToSource(relnumeratorCode); 
 childObsnumeratorRelationshipToSources.add(childObsnumeratorRelationshipToSource); 
 childObsnumerator.setRelationshipToSources(childObsnumeratorRelationshipToSources); 
 insert(childObsnumerator); 
 namedObjects.put("childObsnumerator", childObsnumerator); 
 insert(relnumerator); 
 namedObjects.put("relnumerator", relnumerator); 
 IVLDate obsTimedenominator = new IVLDate(); 
 obsTimedenominator.setLow($evalTime); 
 obsTimedenominator.setHigh($evalTime); 
 ObservationResult childObsdenominator = new ObservationResult(); 
 String childObsdenominatorId = "2.16.840.1.113883.3.795.5.1.1^denominator"; 
 childObsdenominator.setId(childObsdenominatorId); 
 childObsdenominator.setEvaluatedPersonId($evaluatedPersonId); 
 childObsdenominator.setObservationEventTime(obsTimedenominator); 
 childObsdenominator.setSubjectIsFocalPerson($evaluatedPersonId == $focalPersonId); 
 childObsdenominator.setClinicalStatementToBeRoot(false); 
 childObsdenominator.setToBeReturned(true); 
 CD childObsdenominatorFocus = new CD(); 
 childObsdenominatorFocus.setCodeSystem("2.16.840.1.113883.3.795.12.1.1"); 
 childObsdenominatorFocus.setCodeSystemName("OpenCDS concepts"); 
 childObsdenominatorFocus.setCode("C529"); 
 childObsdenominatorFocus.setDisplayName(getOpenCDSConceptName("C529")); 
 childObsdenominator.setObservationFocus(childObsdenominatorFocus); 
 int iChildObsdenominator = 0; 
 INT childObsdenominatorIntegerValue = new INT(); 
 childObsdenominatorIntegerValue.setValue(iChildObsdenominator); 
 ObservationValue childObsdenominatorValue = new ObservationValue(); 
 childObsdenominatorValue.setInteger(childObsdenominatorIntegerValue); 
 childObsdenominator.setObservationValue(childObsdenominatorValue); 
 ClinicalStatementRelationship reldenominator = new ClinicalStatementRelationship(); 
 reldenominator.setSourceId("2.16.840.1.113883.3.795.5.1.1^ROOT"); 
 reldenominator.setTargetId("2.16.840.1.113883.3.795.5.1.1^denominator"); 
 CD reldenominatorCode = new CD(); 
 reldenominatorCode.setCodeSystem("2.16.840.1.113883.3.795.12.1.1"); 
 reldenominatorCode.setCodeSystemName("OpenCDS concepts"); 
 reldenominatorCode.setCode("C405"); 
 reldenominatorCode.setDisplayName("Part of"); 
 reldenominator.setTargetRelationshipToSource(reldenominatorCode); 
 java.util.List<RelationshipToSource> childObsdenominatorRelationshipToSources = 
	 new java.util.ArrayList<RelationshipToSource>(); 
 RelationshipToSource childObsdenominatorRelationshipToSource = new RelationshipToSource(); 
 childObsdenominatorRelationshipToSource.setSourceId("2.16.840.1.113883.3.795.5.1.1^ROOT"); 
 childObsdenominatorRelationshipToSource.setRelationshipToSource(reldenominatorCode); 
 childObsdenominatorRelationshipToSources.add(childObsdenominatorRelationshipToSource); 
 childObsdenominator.setRelationshipToSources(childObsdenominatorRelationshipToSources); 
 insert(childObsdenominator); 
 namedObjects.put("childObsdenominator", childObsdenominator); 
 insert(reldenominator); 
 namedObjects.put("reldenominator", reldenominator); 
//DslUsed==Out.Nested.Obs.Num.Denom.Dsl|||DENOMVALUE==0|||DENOMID==denominator|||NUMVALUE==0|||NUMID==numerator|||ROOT==ROOT|||OBSFOCUS==C529
		assertions.add("reject"); 
insert(new Assertion("reject")); 
//DslUsed==Assert.String.Dsl|||ASSERTIONSTRING==reject
		IVLDate obsTimeASSERTROOT = new IVLDate(); 
 obsTimeASSERTROOT.setLow($evalTime); 
 obsTimeASSERTROOT.setHigh($evalTime); 
 ObservationResult parentObsASSERTROOT = new ObservationResult(); 
 String parentObsASSERTROOTId = "2.16.840.1.113883.3.795.5.1.1^ASSERTROOT"; 
 parentObsASSERTROOT.setId(parentObsASSERTROOTId); 
 parentObsASSERTROOT.setEvaluatedPersonId($evaluatedPersonId); 
 parentObsASSERTROOT.setObservationEventTime(obsTimeASSERTROOT); 
 parentObsASSERTROOT.setSubjectIsFocalPerson($evaluatedPersonId == $focalPersonId); 
 CD parentObsASSERTROOTFocus = new CD(); 
 parentObsASSERTROOTFocus.setCodeSystem("2.16.840.1.113883.3.795.12.1.1"); 
 parentObsASSERTROOTFocus.setCodeSystemName("OpenCDS concepts"); 
 parentObsASSERTROOTFocus.setCode("assertions"); 
 parentObsASSERTROOTFocus.setDisplayName("Assertions found in working memory"); 
 parentObsASSERTROOT.setObservationFocus(parentObsASSERTROOTFocus); 
 parentObsASSERTROOT.setClinicalStatementToBeRoot(true); 
 parentObsASSERTROOT.setToBeReturned(true); 
 ObservationValue obsValueASSERTROOT = new ObservationValue(); 
obsValueASSERTROOT.setText(getAssertionsAsString(assertions)); 
parentObsASSERTROOT.setObservationValue(obsValueASSERTROOT); 
 insert(parentObsASSERTROOT); 
 namedObjects.put("parentObsASSERTROOT", (Object)parentObsASSERTROOT);
end


rule "G.01 IncludeAgeGE21LT234Months"
	ruleflow-group "denominatorInclusions"
	dialect "java"
	when
( EvalTime($evalTime : evalTimeValue) and 
	FocalPersonId($focalPersonId : id) and 
	FocalPersonId($evaluatedPersonId : id) )
( EvaluatedPerson 	(
	id == $evaluatedPersonId,
	demographics != null,
	eval(getAgeInTimeUnitAtTime(demographics.getBirthTime(), 
		org.opencds.common.utilities.DateUtility.getInstance().getDateAfterAddingTime(
		org.opencds.common.utilities.DateUtility.getInstance().getDateAfterAddingTime(
		$evalTime, 2, -1 * 18), 5, -1 * +1 * 0), 2) >=  3) 	) )
( EvaluatedPerson 	(
	id == $evaluatedPersonId,
	demographics != null,
	eval(getAgeInTimeUnitAtTime(demographics.getBirthTime(), 
		org.opencds.common.utilities.DateUtility.getInstance().getDateAfterAddingTime(
		org.opencds.common.utilities.DateUtility.getInstance().getDateAfterAddingTime(
		$evalTime, 2, -1 * 6), 1, -1 * +1 * 1), 1) <  19) 	) )
	then
		insert(new Assertion("C3216")); 
assertions.add("C3216"); 
//DslUsed==Assert.Dsl|||ASSERTION==C3216
end


rule "G.02 ListURIOutpatientEncounters"
	ruleflow-group "denominatorInclusions"
	dialect "java"
	when
		( EvalTime($evalTime : evalTimeValue) and 
			FocalPersonId($focalPersonId : id) and 
			FocalPersonId($evaluatedPersonId : id) )
( 	
				$EREDIBTC_EncTypeConceptTargetIds_0EncListAC2964Low18262C3151C405: 
	java.util.List (size >= 0 ) from accumulate  	(
  		EncounterTypeConcept 		(
  		openCdsConceptCode == "C2964",
 		$EREDIBTC_EncTypeConceptTargetId_0EncListAC2964Low18262C3151C405: 
		conceptTargetId  		), 	init (ArrayList 
	$EREDIBTC_TempEncTypeConceptTargetIds_0EncListAC2964Low18262C3151C405
								= new ArrayList(); 
), 	action (
	$EREDIBTC_TempEncTypeConceptTargetIds_0EncListAC2964Low18262C3151C405.add(
	$EREDIBTC_EncTypeConceptTargetId_0EncListAC2964Low18262C3151C405); 
), 	reverse (
	$EREDIBTC_TempEncTypeConceptTargetIds_0EncListAC2964Low18262C3151C405.remove(
	$EREDIBTC_EncTypeConceptTargetId_0EncListAC2964Low18262C3151C405); 
), 	result(
	$EREDIBTC_TempEncTypeConceptTargetIds_0EncListAC2964Low18262C3151C405) 	) and
	   	$EREDIBTC_ProbIds_0EncListAC2964Low18262C3151C405: 
java.util.List (size >= 0 ) from accumulate  	(
	  		ProblemConcept 		(
	  		openCdsConceptCode == "C3151",
	 		$EREDIBTC_ProbConceptTargetId_0EncListAC2964Low18262C3151C405: 
conceptTargetId  		), 	init (ArrayList 
	$EREDIBTC_TempProbConceptTargetIds_0EncListAC2964Low18262C3151C405
	= new ArrayList(); 
), 	action (
	$EREDIBTC_TempProbConceptTargetIds_0EncListAC2964Low18262C3151C405.add(
	$EREDIBTC_ProbConceptTargetId_0EncListAC2964Low18262C3151C405); 
), 	reverse (
	$EREDIBTC_TempProbConceptTargetIds_0EncListAC2964Low18262C3151C405.remove(
	$EREDIBTC_ProbConceptTargetId_0EncListAC2964Low18262C3151C405); 
), 	result(
	$EREDIBTC_TempProbConceptTargetIds_0EncListAC2964Low18262C3151C405)
		 	) and
	   	$EREDIBTC_CSRelConceptTargetIds_0EncListAC2964Low18262C3151C405: 
java.util.List (size >= 0 ) from accumulate  	(
	  		ClinicalStatementRelationshipConcept 		(
	  		openCdsConceptCode == "C405",
	 		$EREDIBTC_CSRelConceptTargetId_0EncListAC2964Low18262C3151C405: 
conceptTargetId  		), 	init (ArrayList 
	$EREDIBTC_TempCSRelConceptTargetIds_0EncListAC2964Low18262C3151C405
		= new ArrayList(); 
), 	action ( 
	$EREDIBTC_TempCSRelConceptTargetIds_0EncListAC2964Low18262C3151C405.add(
	$EREDIBTC_CSRelConceptTargetId_0EncListAC2964Low18262C3151C405); 
), 	reverse ( 
	$EREDIBTC_TempCSRelConceptTargetIds_0EncListAC2964Low18262C3151C405.remove(
	$EREDIBTC_CSRelConceptTargetId_0EncListAC2964Low18262C3151C405); 
), 	result(
	$EREDIBTC_TempCSRelConceptTargetIds_0EncListAC2964Low18262C3151C405)
		 	) and
	   	$EREDIBTC_CSRelSourceIds_0EncListAC2964Low18262C3151C405: 
java.util.List (size >= 0 ) from accumulate  	(
	ClinicalStatementRelationship 		(
	id memberOf 
		$EREDIBTC_CSRelConceptTargetIds_0EncListAC2964Low18262C3151C405,
	targetId memberOf $EREDIBTC_ProbIds_0EncListAC2964Low18262C3151C405,
	$EREDIBTC_CSRelSourceId_0EncListAC2964Low18262C3151C405: 
sourceId memberOf 
	$EREDIBTC_EncTypeConceptTargetIds_0EncListAC2964Low18262C3151C405 ),
	 	init (ArrayList 
		$EREDIBTC_TempCSRelSourceIds_0EncListAC2964Low18262C3151C405
				= new ArrayList(); 
), 	action ( 
	$EREDIBTC_TempCSRelSourceIds_0EncListAC2964Low18262C3151C405.add(
	$EREDIBTC_CSRelSourceId_0EncListAC2964Low18262C3151C405); 
), 	reverse ( 
	$EREDIBTC_TempCSRelSourceIds_0EncListAC2964Low18262C3151C405.remove(
	$EREDIBTC_CSRelSourceId_0EncListAC2964Low18262C3151C405); 
), 	result( 
	$EREDIBTC_TempCSRelSourceIds_0EncListAC2964Low18262C3151C405) 	) and
	  	$EREDIBTC_FinalEncIds_0EncListAC2964Low18262C3151C405: 
java.util.List (size >= 0 ) from accumulate  	(
	  		EncounterEvent 		(
	  			$EREDIBTC_FinalEncId_0EncListAC2964Low18262C3151C405: 
id memberOf $EREDIBTC_CSRelSourceIds_0EncListAC2964Low18262C3151C405,
evaluatedPersonId == $evaluatedPersonId,
eval(timeBeforeByAtMost(encounterEventTime.getLow(), $evalTime, 
	18, 2, namedObjects)),
eval(timeBeforeByMoreThan(encounterEventTime.getLow(), $evalTime, 
	6, 2, namedObjects)) 		),
	 	init (ArrayList 
	$EREDIBTC_TempFinalEncIds_0EncListAC2964Low18262C3151C405
	= new ArrayList(); 
), 	action ( 
	$EREDIBTC_TempFinalEncIds_0EncListAC2964Low18262C3151C405.add(
	$EREDIBTC_FinalEncId_0EncListAC2964Low18262C3151C405); 
), 	reverse ( 
	$EREDIBTC_TempFinalEncIds_0EncListAC2964Low18262C3151C405.remove(
	$EREDIBTC_FinalEncId_0EncListAC2964Low18262C3151C405); 
), 	result( 
	$EREDIBTC_TempFinalEncIds_0EncListAC2964Low18262C3151C405)
	 	) and EncListA : 
java.util.List( size >= 0 ) from collect  	(
	  		EncounterEvent 		(
	 			id memberOf $EREDIBTC_FinalEncIds_0EncListAC2964Low18262C3151C405 )
	 	) and
	 	$EREDIBTC_FinalProbIds_0EncListAC2964Low18262C3151C405: 
java.util.List (size >= 0 ) from accumulate  	(
	ClinicalStatementRelationship 		(
		id memberOf $EREDIBTC_CSRelConceptTargetIds_0EncListAC2964Low18262C3151C405,
		sourceId memberOf $EREDIBTC_FinalEncIds_0EncListAC2964Low18262C3151C405,
		$EREDIBTC_FinalProbId_0EncListAC2964Low18262C3151C405: 
		targetId memberOf 
			$EREDIBTC_ProbIds_0EncListAC2964Low18262C3151C405 ),
			 	init (ArrayList 
			$EREDIBTC_TempFinalProbIds_0EncListAC2964Low18262C3151C405
			= new ArrayList(); 
), 	action ( 
	$EREDIBTC_TempFinalProbIds_0EncListAC2964Low18262C3151C405.add(
	$EREDIBTC_FinalProbId_0EncListAC2964Low18262C3151C405); 
), 	reverse ( 
	$EREDIBTC_TempFinalProbIds_0EncListAC2964Low18262C3151C405.remove(
	$EREDIBTC_FinalProbId_0EncListAC2964Low18262C3151C405); 
), 	result( $EREDIBTC_TempFinalProbIds_0EncListAC2964Low18262C3151C405) 	) and
	  	$EREDIBTC_ProbList_0EncListAC2964Low18262C3151C405: java.util.List( size >= 0 )
	 from collect  	(  		Problem 		( 			id memberOf
		  $EREDIBTC_FinalProbIds_0EncListAC2964Low18262C3151C405 ) 	) and
 	EvaluatedPerson(eval(flagClinicalStatementListToReturnInOutput(EncListA)),
			   eval(flagClinicalStatementListToReturnInOutput(
						 $EREDIBTC_ProbList_0EncListAC2964Low18262C3151C405)))
								    ) //DslUsed==Enc.Rship.EncDx.Imp.Between.Times.Count.Id.Dsl|||INT1==0|||ENCLISTID==EncListA|||ENCTYPE==C2964|||HIGHLOW==Low|||INT2==18|||TIMEUNITS2==2|||INT3==6|||TIMEUNITS3==2|||PROB==C3151|||CSREL==C405|||PROBIMP=={PROBIMP}
	then
		namedObjects.put('URIOutpatientEncounters', EncListA); 
NamedList  $namedListEncListA = new NamedList(); 
$namedListEncListA.setName('URIOutpatientEncounters'); 
$namedListEncListA.setList(EncListA); 
 insert ($namedListEncListA); 
//DslUsed==Insert.EncListRef.As.NamedList.Dsl|||ENCLISTID==EncListA|||NAME==URIOutpatientEncounters
end


rule "G.03 ListURIObservationEncounters"
	ruleflow-group "denominatorInclusions"
	dialect "java"
	when
		( EvalTime($evalTime : evalTimeValue) 
			and FocalPersonId($focalPersonId : id) and 
			FocalPersonId($evaluatedPersonId : id) )
( /*  */ 	
$EREDIBTC_EncTypeConceptTargetIds_0EncListAC3022Low18262C3151C405: 
	java.util.List (size >= 0 ) from accumulate  	(
  		EncounterTypeConcept 		(
  		openCdsConceptCode == "C3022",
 		$EREDIBTC_EncTypeConceptTargetId_0EncListAC3022Low18262C3151C405: 
			conceptTargetId  		), 	init (ArrayList 
		$EREDIBTC_TempEncTypeConceptTargetIds_0EncListAC3022Low18262C3151C405
		= new ArrayList(); 
), 	action (
	$EREDIBTC_TempEncTypeConceptTargetIds_0EncListAC3022Low18262C3151C405.add(
	$EREDIBTC_EncTypeConceptTargetId_0EncListAC3022Low18262C3151C405); 
), 	reverse (
	$EREDIBTC_TempEncTypeConceptTargetIds_0EncListAC3022Low18262C3151C405.remove(
	$EREDIBTC_EncTypeConceptTargetId_0EncListAC3022Low18262C3151C405); 
), 	result(
	$EREDIBTC_TempEncTypeConceptTargetIds_0EncListAC3022Low18262C3151C405)
	 	) and
	   	$EREDIBTC_ProbIds_0EncListAC3022Low18262C3151C405: 
java.util.List (size >= 0 ) from accumulate  	(
	  		ProblemConcept 		(
	  		openCdsConceptCode == "C3151",
	 		$EREDIBTC_ProbConceptTargetId_0EncListAC3022Low18262C3151C405: 
conceptTargetId  		), 	init (ArrayList 
	$EREDIBTC_TempProbConceptTargetIds_0EncListAC3022Low18262C3151C405
	= new ArrayList(); 
), 	action (
	$EREDIBTC_TempProbConceptTargetIds_0EncListAC3022Low18262C3151C405.add(
	$EREDIBTC_ProbConceptTargetId_0EncListAC3022Low18262C3151C405); 
), 	reverse (
	$EREDIBTC_TempProbConceptTargetIds_0EncListAC3022Low18262C3151C405.remove(
	$EREDIBTC_ProbConceptTargetId_0EncListAC3022Low18262C3151C405); 
), 	result(
	$EREDIBTC_TempProbConceptTargetIds_0EncListAC3022Low18262C3151C405) 	) and
	$EREDIBTC_CSRelConceptTargetIds_0EncListAC3022Low18262C3151C405: 
		java.util.List (size >= 0 ) from accumulate  	(
	  		ClinicalStatementRelationshipConcept 		(
	  		openCdsConceptCode == "C405",
	 		$EREDIBTC_CSRelConceptTargetId_0EncListAC3022Low18262C3151C405: 
				conceptTargetId  		), 	init (ArrayList 
	$EREDIBTC_TempCSRelConceptTargetIds_0EncListAC3022Low18262C3151C405
	= new ArrayList(); 
), 	action ( 
	$EREDIBTC_TempCSRelConceptTargetIds_0EncListAC3022Low18262C3151C405.add(
	$EREDIBTC_CSRelConceptTargetId_0EncListAC3022Low18262C3151C405); 
), 	reverse ( 
	$EREDIBTC_TempCSRelConceptTargetIds_0EncListAC3022Low18262C3151C405.remove(
	$EREDIBTC_CSRelConceptTargetId_0EncListAC3022Low18262C3151C405); 
), 	result(
	$EREDIBTC_TempCSRelConceptTargetIds_0EncListAC3022Low18262C3151C405)
	 	) and
	$EREDIBTC_CSRelSourceIds_0EncListAC3022Low18262C3151C405: 
		java.util.List (size >= 0 ) from accumulate  	(
	ClinicalStatementRelationship 		(
	id memberOf $EREDIBTC_CSRelConceptTargetIds_0EncListAC3022Low18262C3151C405,
	targetId memberOf $EREDIBTC_ProbIds_0EncListAC3022Low18262C3151C405,
	$EREDIBTC_CSRelSourceId_0EncListAC3022Low18262C3151C405: sourceId memberOf 
		$EREDIBTC_EncTypeConceptTargetIds_0EncListAC3022Low18262C3151C405 ),
		 	init (ArrayList $EREDIBTC_TempCSRelSourceIds_0EncListAC3022Low18262C3151C405
		= new ArrayList(); 
), 	action ( 
	$EREDIBTC_TempCSRelSourceIds_0EncListAC3022Low18262C3151C405.add(
	$EREDIBTC_CSRelSourceId_0EncListAC3022Low18262C3151C405); 
), 	reverse ( 
	$EREDIBTC_TempCSRelSourceIds_0EncListAC3022Low18262C3151C405.remove(
	$EREDIBTC_CSRelSourceId_0EncListAC3022Low18262C3151C405); 
), 	result( 
	$EREDIBTC_TempCSRelSourceIds_0EncListAC3022Low18262C3151C405) 	) and
	   	$EREDIBTC_FinalEncIds_0EncListAC3022Low18262C3151C405: 
java.util.List (size >= 0 ) from accumulate  	(
	  		EncounterEvent 		(
	  			$EREDIBTC_FinalEncId_0EncListAC3022Low18262C3151C405: id memberOf 
	$EREDIBTC_CSRelSourceIds_0EncListAC3022Low18262C3151C405,
	  			evaluatedPersonId == $evaluatedPersonId,
	eval(timeBeforeByAtMost(encounterEventTime.getLow(), $evalTime, 18, 2, namedObjects)),
	eval(timeBeforeByMoreThan(encounterEventTime.getLow(), $evalTime, 6, 2, namedObjects))
		 		), 	init (ArrayList 
		$EREDIBTC_TempFinalEncIds_0EncListAC3022Low18262C3151C405
		= new ArrayList(); 
), 	action ( 
	$EREDIBTC_TempFinalEncIds_0EncListAC3022Low18262C3151C405.add(
	$EREDIBTC_FinalEncId_0EncListAC3022Low18262C3151C405); 
), 	reverse ( 
	$EREDIBTC_TempFinalEncIds_0EncListAC3022Low18262C3151C405.remove(
	$EREDIBTC_FinalEncId_0EncListAC3022Low18262C3151C405); 
), 	result( $EREDIBTC_TempFinalEncIds_0EncListAC3022Low18262C3151C405) 	) and 
	EncListA : java.util.List( size >= 0 ) from collect  	(
  		EncounterEvent 		(
			id memberOf $EREDIBTC_FinalEncIds_0EncListAC3022Low18262C3151C405 )
				 	) and
			 	$EREDIBTC_FinalProbIds_0EncListAC3022Low18262C3151C405: 
		java.util.List (size >= 0 ) from accumulate  	(
			ClinicalStatementRelationship 		(
	id memberOf $EREDIBTC_CSRelConceptTargetIds_0EncListAC3022Low18262C3151C405, 
	sourceId memberOf $EREDIBTC_FinalEncIds_0EncListAC3022Low18262C3151C405, 
					$EREDIBTC_FinalProbId_0EncListAC3022Low18262C3151C405: 
	targetId memberOf $EREDIBTC_ProbIds_0EncListAC3022Low18262C3151C405 ), 	
	init (ArrayList $EREDIBTC_TempFinalProbIds_0EncListAC3022Low18262C3151C40
		5= new ArrayList(); 
), 	action ( $EREDIBTC_TempFinalProbIds_0EncListAC3022Low18262C3151C405.add(
	$EREDIBTC_FinalProbId_0EncListAC3022Low18262C3151C405); 
), 	reverse ( $EREDIBTC_TempFinalProbIds_0EncListAC3022Low18262C3151C405.remove(
	$EREDIBTC_FinalProbId_0EncListAC3022Low18262C3151C405); 
), 	result( $EREDIBTC_TempFinalProbIds_0EncListAC3022Low18262C3151C405)
	 	) and
	  	$EREDIBTC_ProbList_0EncListAC3022Low18262C3151C405: 
		java.util.List( size >= 0 ) from collect  	(
			Problem 		(
			id memberOf
		$EREDIBTC_FinalProbIds_0EncListAC3022Low18262C3151C405 ) 	) and
		EvaluatedPerson(
				eval(flagClinicalStatementListToReturnInOutput(EncListA)),
				eval(flagClinicalStatementListToReturnInOutput(
			$EREDIBTC_ProbList_0EncListAC3022Low18262C3151C405))) ) //DslUsed==Enc.Rship.EncDx.Imp.Between.Times.Count.Id.Dsl|||INT1==0|||ENCLISTID==EncListA|||ENCTYPE==C3022|||HIGHLOW==Low|||INT2==18|||TIMEUNITS2==2|||INT3==6|||TIMEUNITS3==2|||PROB==C3151|||CSREL==C405|||PROBIMP=={PROBIMP}
	then
		namedObjects.put('URIObservationEncounters', EncListA); 
NamedList  $namedListEncListA = new NamedList(); 
$namedListEncListA.setName('URIObservationEncounters'); 
$namedListEncListA.setList(EncListA); 
 insert ($namedListEncListA); 
//DslUsed==Insert.EncListRef.As.NamedList.Dsl|||ENCLISTID==EncListA|||NAME==URIObservationEncounters
end


rule "G.04 ListURIEDEncounters"
	ruleflow-group "denominatorInclusions"
	dialect "java"
	when
		( EvalTime($evalTime : evalTimeValue) and FocalPersonId($focalPersonId : id) and 
			FocalPersonId($evaluatedPersonId : id) )
		( 	
	$EREDIBTC_EncTypeConceptTargetIds_0EncListAC2968Low18262C3151C405: 
			java.util.List (size >= 0 ) from accumulate  	(
			  		EncounterTypeConcept 		(
			  		openCdsConceptCode == "C2968",
			 		$EREDIBTC_EncTypeConceptTargetId_0EncListAC2968Low18262C3151C405: 
			conceptTargetId  		), 	init (
			ArrayList $EREDIBTC_TempEncTypeConceptTargetIds_0EncListAC2968Low18262C3151C405
				= new ArrayList(); 
), 	action ($EREDIBTC_TempEncTypeConceptTargetIds_0EncListAC2968Low18262C3151C405.add(
	$EREDIBTC_EncTypeConceptTargetId_0EncListAC2968Low18262C3151C405); 
), 	reverse ($EREDIBTC_TempEncTypeConceptTargetIds_0EncListAC2968Low18262C3151C405.remove(
	$EREDIBTC_EncTypeConceptTargetId_0EncListAC2968Low18262C3151C405); 
), 	result($EREDIBTC_TempEncTypeConceptTargetIds_0EncListAC2968Low18262C3151C405) 	) and
	   	$EREDIBTC_ProbIds_0EncListAC2968Low18262C3151C405: 
				java.util.List (size >= 0 ) from accumulate  	(
	  		ProblemConcept 		(
	  		openCdsConceptCode == "C3151",
	 		$EREDIBTC_ProbConceptTargetId_0EncListAC2968Low18262C3151C405: 
				conceptTargetId  		), 	init (
	ArrayList $EREDIBTC_TempProbConceptTargetIds_0EncListAC2968Low18262C3151C405
		= new ArrayList(); 
), 	action ($EREDIBTC_TempProbConceptTargetIds_0EncListAC2968Low18262C3151C405.add(
	$EREDIBTC_ProbConceptTargetId_0EncListAC2968Low18262C3151C405); 
), 	reverse ($EREDIBTC_TempProbConceptTargetIds_0EncListAC2968Low18262C3151C405.remove(
	$EREDIBTC_ProbConceptTargetId_0EncListAC2968Low18262C3151C405); 
), 	result($EREDIBTC_TempProbConceptTargetIds_0EncListAC2968Low18262C3151C405) 	) and
	   	$EREDIBTC_CSRelConceptTargetIds_0EncListAC2968Low18262C3151C405: 
				java.util.List (size >= 0 ) from accumulate  	(
	  		ClinicalStatementRelationshipConcept 		(
	  		openCdsConceptCode == "C405",
	 		$EREDIBTC_CSRelConceptTargetId_0EncListAC2968Low18262C3151C405: 
					conceptTargetId  		), 	init (
	ArrayList $EREDIBTC_TempCSRelConceptTargetIds_0EncListAC2968Low18262C3151C405
		= new ArrayList(); 
), 	action ( $EREDIBTC_TempCSRelConceptTargetIds_0EncListAC2968Low18262C3151C405.add(
	$EREDIBTC_CSRelConceptTargetId_0EncListAC2968Low18262C3151C405); 
), 	reverse ( $EREDIBTC_TempCSRelConceptTargetIds_0EncListAC2968Low18262C3151C405.remove(
	$EREDIBTC_CSRelConceptTargetId_0EncListAC2968Low18262C3151C405); 
), 	result($EREDIBTC_TempCSRelConceptTargetIds_0EncListAC2968Low18262C3151C405) 	) and
	   	$EREDIBTC_CSRelSourceIds_0EncListAC2968Low18262C3151C405: 
				java.util.List (size >= 0 ) from accumulate  	(
	  		ClinicalStatementRelationship 		(
	  		id memberOf $EREDIBTC_CSRelConceptTargetIds_0EncListAC2968Low18262C3151C405,
	 		targetId memberOf $EREDIBTC_ProbIds_0EncListAC2968Low18262C3151C405,
	 		$EREDIBTC_CSRelSourceId_0EncListAC2968Low18262C3151C405: sourceId memberOf 
				$EREDIBTC_EncTypeConceptTargetIds_0EncListAC2968Low18262C3151C405 ),
				 	init (
				ArrayList $EREDIBTC_TempCSRelSourceIds_0EncListAC2968Low18262C3151C405
							= new ArrayList(); 
), 	action ( $EREDIBTC_TempCSRelSourceIds_0EncListAC2968Low18262C3151C405.add(
	$EREDIBTC_CSRelSourceId_0EncListAC2968Low18262C3151C405); 
), 	reverse ( $EREDIBTC_TempCSRelSourceIds_0EncListAC2968Low18262C3151C405.remove(
	$EREDIBTC_CSRelSourceId_0EncListAC2968Low18262C3151C405); 
), 	result( $EREDIBTC_TempCSRelSourceIds_0EncListAC2968Low18262C3151C405) 	) and
	   	$EREDIBTC_FinalEncIds_0EncListAC2968Low18262C3151C405: 
				java.util.List (size >= 0 ) from accumulate  	(
	  		EncounterEvent 		(
	  			$EREDIBTC_FinalEncId_0EncListAC2968Low18262C3151C405: id 
	memberOf $EREDIBTC_CSRelSourceIds_0EncListAC2968Low18262C3151C405,
	  			evaluatedPersonId == $evaluatedPersonId,  			
	eval(timeBeforeByAtMost(encounterEventTime.getLow(), $evalTime, 
									18, 2, namedObjects)), 			
		eval(timeBeforeByMoreThan(encounterEventTime.getLow(), $evalTime, 
										6, 2, namedObjects)) 		
		),
		 	init (
		ArrayList $EREDIBTC_TempFinalEncIds_0EncListAC2968Low18262C3151C405
											= new ArrayList(); 
), 	action ( $EREDIBTC_TempFinalEncIds_0EncListAC2968Low18262C3151C405.add(
	$EREDIBTC_FinalEncId_0EncListAC2968Low18262C3151C405); 
), 	reverse ( $EREDIBTC_TempFinalEncIds_0EncListAC2968Low18262C3151C405.remove(
	$EREDIBTC_FinalEncId_0EncListAC2968Low18262C3151C405); 
), 	result( $EREDIBTC_TempFinalEncIds_0EncListAC2968Low18262C3151C405) 	) and 
	EncListA : java.util.List( size >= 0 ) from collect  	(  		EncounterEvent 		( 			
		id memberOf $EREDIBTC_FinalEncIds_0EncListAC2968Low18262C3151C405 ) 	
		) and 	
		$EREDIBTC_FinalProbIds_0EncListAC2968Low18262C3151C405: java.util.List 
		(size >= 0 ) from accumulate  	(  		
		ClinicalStatementRelationship 		(  			
		id memberOf $EREDIBTC_CSRelConceptTargetIds_0EncListAC2968Low18262C3151C405, 			
		sourceId memberOf $EREDIBTC_FinalEncIds_0EncListAC2968Low18262C3151C405,
			$EREDIBTC_FinalProbId_0EncListAC2968Low18262C3151C405: targetId 
		memberOf $EREDIBTC_ProbIds_0EncListAC2968Low18262C3151C405 ), 	init (
		ArrayList $EREDIBTC_TempFinalProbIds_0EncListAC2968Low18262C3151C405
				= new ArrayList(); 
), 	action ( $EREDIBTC_TempFinalProbIds_0EncListAC2968Low18262C3151C405.add(
	$EREDIBTC_FinalProbId_0EncListAC2968Low18262C3151C405); 
), 	reverse ( $EREDIBTC_TempFinalProbIds_0EncListAC2968Low18262C3151C405.remove(
	$EREDIBTC_FinalProbId_0EncListAC2968Low18262C3151C405); 
), 	result( $EREDIBTC_TempFinalProbIds_0EncListAC2968Low18262C3151C405) 	) and  	$EREDIBTC_ProbList_0EncListAC2968Low18262C3151C405: java.util.List( size >= 0 ) from collect  	(  		Problem 		( 			id memberOf $EREDIBTC_FinalProbIds_0EncListAC2968Low18262C3151C405 ) 	) and 	EvaluatedPerson(eval(flagClinicalStatementListToReturnInOutput(EncListA)), eval(flagClinicalStatementListToReturnInOutput($EREDIBTC_ProbList_0EncListAC2968Low18262C3151C405))) ) //DslUsed==Enc.Rship.EncDx.Imp.Between.Times.Count.Id.Dsl|||INT1==0|||ENCLISTID==EncListA|||ENCTYPE==C2968|||HIGHLOW==Low|||INT2==18|||TIMEUNITS2==2|||INT3==6|||TIMEUNITS3==2|||PROB==C3151|||CSREL==C405|||PROBIMP=={PROBIMP}
	then
		namedObjects.put('URIEDEncounters', EncListA); 
NamedList  $namedListEncListA = new NamedList(); 
$namedListEncListA.setName('URIEDEncounters'); 
$namedListEncListA.setList(EncListA); 
 insert ($namedListEncListA); 
//DslUsed==Insert.EncListRef.As.NamedList.Dsl|||ENCLISTID==EncListA|||NAME==URIEDEncounters
end


rule "G.05 ListAcuteInpatientEncounters"
	ruleflow-group "denominatorInclusions"
	dialect "java"
	when
		( EvalTime($evalTime : evalTimeValue) and FocalPersonId($focalPersonId : id) 
			and FocalPersonId($evaluatedPersonId : id) )
		( 	$EBTCI_EncTypeConceptTargetIds_0EncListAC2971Low18262 : 
java.util.List (size >= 0 ) from accumulate  	(
			  		EncounterTypeConcept 		(
			  		openCdsConceptCode == "C2971",
			 		$EBTCI_EncTypeConceptTargetId_0EncListAC2971Low18262 : 
conceptTargetId  		), 	init (
			ArrayList $EBTCI_TempEncTypeConceptTargetIds_0EncListAC2971Low18262
			 = new ArrayList(); 
), 	action ($EBTCI_TempEncTypeConceptTargetIds_0EncListAC2971Low18262.add(
	$EBTCI_EncTypeConceptTargetId_0EncListAC2971Low18262); 
), 	reverse ($EBTCI_TempEncTypeConceptTargetIds_0EncListAC2971Low18262.remove(
	$EBTCI_EncTypeConceptTargetId_0EncListAC2971Low18262); 
), 	result($EBTCI_TempEncTypeConceptTargetIds_0EncListAC2971Low18262) 	) and
	   	$EBTCI_FinalEncIds_0EncListAC2971Low18262 : 
java.util.List (size >= 0 ) from accumulate  	(
	  		EncounterEvent 		(
	  			$EBTCI_FinalEncId_0EncListAC2971Low18262 : 
			id memberOf $EBTCI_EncTypeConceptTargetIds_0EncListAC2971Low18262,
	  			evaluatedPersonId == $evaluatedPersonId,
	eval(timeBeforeByAtMost(encounterEventTime.getLow(), $evalTime, 
		18, 2, namedObjects)), 
	eval(timeBeforeByMoreThan(encounterEventTime.getLow(), $evalTime, 
		6, 2, namedObjects)) 		), 	init (
					ArrayList $EBTCI_TempFinalEncIds_0EncListAC2971Low18262
						= new ArrayList(); 
), 	action ( $EBTCI_TempFinalEncIds_0EncListAC2971Low18262.add(
	$EBTCI_FinalEncId_0EncListAC2971Low18262); 
), 	reverse ( $EBTCI_TempFinalEncIds_0EncListAC2971Low18262.remove(
	$EBTCI_FinalEncId_0EncListAC2971Low18262); 
), 	result( $EBTCI_TempFinalEncIds_0EncListAC2971Low18262) 	) and EncListA : java.util.List( size >= 0 ) from collect  	(  		EncounterEvent 		( 			id memberOf $EBTCI_FinalEncIds_0EncListAC2971Low18262 ) 	) and 	EvaluatedPerson(eval(flagClinicalStatementListToReturnInOutput(EncListA))) ) //DslUsed==Enc.Between.Times.Count.Id.Dsl|||INT1==0|||ENCLISTID==EncListA|||ENCTYPE==C2971|||HIGHLOW==Low|||INT2==18|||TIMEUNITS2==2|||INT3==6|||TIMEUNITS3==2
	then
		namedObjects.put('AcuteInpatientEncounters', EncListA); 
NamedList  $namedListEncListA = new NamedList(); 
$namedListEncListA.setName('AcuteInpatientEncounters'); 
$namedListEncListA.setList(EncListA); 
 insert ($namedListEncListA); 
//DslUsed==Insert.EncListRef.As.NamedList.Dsl|||ENCLISTID==EncListA|||NAME==AcuteInpatientEncounters
end


rule "G.06 ListNonAcuteInpatientEncounters"
	ruleflow-group "denominatorInclusions"
	dialect "java"
	when
		( EvalTime($evalTime : evalTimeValue) and FocalPersonId($focalPersonId : id) 
			and FocalPersonId($evaluatedPersonId : id) )
		( 	$EBTCI_EncTypeConceptTargetIds_0EncListAC3020Low18262 : 
			java.util.List (size >= 0 ) from accumulate  	(
			  		EncounterTypeConcept 		(
			  		openCdsConceptCode == "C3020",
			 		$EBTCI_EncTypeConceptTargetId_0EncListAC3020Low18262 : 
					conceptTargetId  		), 	init (
			ArrayList $EBTCI_TempEncTypeConceptTargetIds_0EncListAC3020Low18262 
						= new ArrayList(); 
), 	action ($EBTCI_TempEncTypeConceptTargetIds_0EncListAC3020Low18262.add(
	$EBTCI_EncTypeConceptTargetId_0EncListAC3020Low18262); 
), 	reverse ($EBTCI_TempEncTypeConceptTargetIds_0EncListAC3020Low18262.remove(
	$EBTCI_EncTypeConceptTargetId_0EncListAC3020Low18262); 
), 	result($EBTCI_TempEncTypeConceptTargetIds_0EncListAC3020Low18262) 	) and
	   	$EBTCI_FinalEncIds_0EncListAC3020Low18262 : 
			java.util.List (size >= 0 ) from accumulate  	(
	  		EncounterEvent 		(
	  			$EBTCI_FinalEncId_0EncListAC3020Low18262 : 
id memberOf $EBTCI_EncTypeConceptTargetIds_0EncListAC3020Low18262,
	  			evaluatedPersonId == $evaluatedPersonId,  			
	eval(timeBeforeByAtMost(encounterEventTime.getLow(), $evalTime, 18, 2, namedObjects)),
	 			eval(timeBeforeByMoreThan(encounterEventTime.getLow(), $evalTime,
					 6, 2, namedObjects))
						  		), 	init (
					ArrayList $EBTCI_TempFinalEncIds_0EncListAC3020Low18262 
												= new ArrayList(); 
), 	action ( $EBTCI_TempFinalEncIds_0EncListAC3020Low18262.add(
	$EBTCI_FinalEncId_0EncListAC3020Low18262); 
), 	reverse ( $EBTCI_TempFinalEncIds_0EncListAC3020Low18262.remove(
	$EBTCI_FinalEncId_0EncListAC3020Low18262); 
), 	result( $EBTCI_TempFinalEncIds_0EncListAC3020Low18262) 	) and EncListA : java.util.List( size >= 0 ) from collect  	(  		EncounterEvent 		( 			id memberOf $EBTCI_FinalEncIds_0EncListAC3020Low18262 ) 	) and 	EvaluatedPerson(eval(flagClinicalStatementListToReturnInOutput(EncListA))) ) //DslUsed==Enc.Between.Times.Count.Id.Dsl|||INT1==0|||ENCLISTID==EncListA|||ENCTYPE==C3020|||HIGHLOW==Low|||INT2==18|||TIMEUNITS2==2|||INT3==6|||TIMEUNITS3==2
	then
		namedObjects.put('NonAcuteInpatientEncounters', EncListA); 
NamedList  $namedListEncListA = new NamedList(); 
$namedListEncListA.setName('NonAcuteInpatientEncounters'); 
$namedListEncListA.setList(EncListA); 
 insert ($namedListEncListA); 
//DslUsed==Insert.EncListRef.As.NamedList.Dsl|||ENCLISTID==EncListA|||NAME==NonAcuteInpatientEncounters
end


rule "G.07 ListURIEncounters"
	ruleflow-group "denominatorInclusions"
	dialect "java"
	when
		( EvalTime($evalTime : evalTimeValue) and FocalPersonId($focalPersonId : id) 
			and FocalPersonId($evaluatedPersonId : id) )
		( 	NamedList 	( 		name == "URIOutpatientEncounters",  		list != null, EncListA : list == ( (List) (namedObjects.get("URIOutpatientEncounters"))) 	) ) //DslUsed==NamedList.Exists.EncListId.Dsl|||ENCLISTID==EncListA|||NAME==URIOutpatientEncounters
		( 	NamedList 	( 		name == "URIObservationEncounters",  		list != null, EncListB : list == ( (List) (namedObjects.get("URIObservationEncounters"))) 	) ) //DslUsed==NamedList.Exists.EncListId.Dsl|||ENCLISTID==EncListB|||NAME==URIObservationEncounters
		( 	NamedList 	( 		name == "URIEDEncounters",  		list != null, EncListC : list == ( (List) (namedObjects.get("URIEDEncounters"))) 	) ) //DslUsed==NamedList.Exists.EncListId.Dsl|||ENCLISTID==EncListC|||NAME==URIEDEncounters
		( 	NamedList 	( 		name == "AcuteInpatientEncounters",  		list != null, EncListD : list == ( (List) (namedObjects.get("AcuteInpatientEncounters"))) 	) ) //DslUsed==NamedList.Exists.EncListId.Dsl|||ENCLISTID==EncListD|||NAME==AcuteInpatientEncounters
		( 	NamedList 	( 		name == "NonAcuteInpatientEncounters",  		list != null, EncListE : list == ( (List) (namedObjects.get("NonAcuteInpatientEncounters"))) 	) ) //DslUsed==NamedList.Exists.EncListId.Dsl|||ENCLISTID==EncListE|||NAME==NonAcuteInpatientEncounters
	then
		List EncListF = getEncListWithNoTimeOverlap(EncListC, EncListD); 
//DslUsed==Set.EncListId.EncListRefs.No.Time.Overlap.Dsl|||ENCLISTID1==EncListF|||ENCLISTID2==EncListC|||ENCLISTID3==EncListD
		List EncListG = getEncListWithNoTimeOverlap(EncListF, EncListE); 
//DslUsed==Set.EncListId.EncListRefs.No.Time.Overlap.Dsl|||ENCLISTID1==EncListG|||ENCLISTID2==EncListF|||ENCLISTID3==EncListE
		List EncListH = new ArrayList(); 
EncListH.addAll(EncListA); 
EncListH.addAll(EncListB); 
//DslUsed==Set.EncListId.Add.EncListRefs.Dsl|||ENCLISTID1==EncListH|||ENCLISTID2==EncListA|||ENCLISTID3==EncListB
		List EncListI = new ArrayList(); 
EncListI.addAll(EncListG); 
EncListI.addAll(EncListH); 
//DslUsed==Set.EncListId.Add.EncListRefs.Dsl|||ENCLISTID1==EncListI|||ENCLISTID2==EncListG|||ENCLISTID3==EncListH
		namedObjects.put('URIEncounters', EncListI); 
NamedList  $namedListEncListI = new NamedList(); 
$namedListEncListI.setName('URIEncounters'); 
$namedListEncListI.setList(EncListI); 
 insert ($namedListEncListI); 
//DslUsed==Insert.EncListRef.As.NamedList.Dsl|||ENCLISTID==EncListI|||NAME==URIEncounters
end


rule "G.08 HasDenominatorInclusions"
	ruleflow-group "denominatorInclusions"
	dialect "java"
	when
		( EvalTime($evalTime : evalTimeValue) and FocalPersonId($focalPersonId : id) 
			and FocalPersonId($evaluatedPersonId : id) )
		( 	Assertion(value == "C3216") ) //DslUsed==Assertion.Exists.Dsl|||ASSERTION==C3216
		( 	NamedList 	( 		name == "URIEncounters",  		list != null, 		list.size() > 0, 		list == ( (List) (namedObjects.get("URIEncounters"))) 	) ) //DslUsed==NamedList.Exists.Not.Empty.Dsl|||NAME==URIEncounters
	then
		insert(new Assertion("C545")); 
assertions.add("C545"); 
//DslUsed==Assert.Dsl|||ASSERTION==C545
end


rule "I.01 ExcludeMultipleClaims"
	ruleflow-group "denominatorExclusions"
	dialect "java"
	when
		( EvalTime($evalTime : evalTimeValue) and FocalPersonId($focalPersonId : id) 
			and FocalPersonId($evaluatedPersonId : id) )
		( 	Assertion(value == "C545") ) //DslUsed==Assertion.Exists.Dsl|||ASSERTION==C545
		 not (
		( 	NamedList 	( 		name == "MultipleClaims",  		list != null, EncListA : list == ( (List) (namedObjects.get("MultipleClaims"))) 	) ) //DslUsed==NamedList.Exists.EncListId.Dsl|||ENCLISTID==EncListA|||NAME==MultipleClaims
		 )
		( 
   	NamedList 	(
   		name == "URIEncounters",
    	list != null,
   		list.size() >= 0,
   		$Encs_EFNLREDNMCI_0EncListBURIEncounters0C3151C405 : 
			list == ( (List) (namedObjects.get("URIEncounters"))) 	) and
   		$EncProbCSRConceptIds_EFNLREDNMCI_0EncListBURIEncounters0C3151C405 : 
				java.util.List (size >= 0) from accumulate 		(
		ClinicalStatementRelationshipConcept 			(
			openCdsConceptCode == "C405",
			$TempId : conceptTargetId  			),
	init (ArrayList $TempIds = new ArrayList(); 
), action ($TempIds.add($TempId); 
), reverse ($TempIds.remove($TempId); 
), result($TempIds) 		) and
		$ProbConceptTargetIds_EFNLREDNMCI_0EncListBURIEncounters0C3151C405 : 
		java.util.List (size >= 0) from accumulate 		(
 			ProblemConcept 			(
  				openCdsConceptCode == "C3151",
			$TempId : conceptTargetId 			),
		init (ArrayList $TempIds = new ArrayList(); 
), action ($TempIds.add($TempId); 
), reverse ($TempIds.remove($TempId); 
), result($TempIds) 		) and
	 		$EncProbIds_EFNLREDNMCI_0EncListBURIEncounters0C3151C405 : 
		java.util.List (size >= 0) from accumulate 		(
	Problem 			(
	evaluatedPersonId == $evaluatedPersonId,
	id not memberOf $ProbConceptTargetIds_EFNLREDNMCI_0EncListBURIEncounters0C3151C405,
	eval((templateId != null) && java.util.Arrays.asList(templateId).contains(
			"2.16.840.1.113883.3.1829.11.7.2.18")),
	$TempId : id 			),
		 init (ArrayList $TempIds = new ArrayList(); 
), action ($TempIds.add($TempId); 
), reverse ($TempIds.remove($TempId); 
), result($TempIds) 		) and
	 $EncProbCSRs_EFNLREDNMCI_0EncListBURIEncounters0C3151C405 : 
	java.util.List (size >= 0 ) from accumulate  		(
  		$TempId : ClinicalStatementRelationship 			(
  			id memberOf 
				$EncProbCSRConceptIds_EFNLREDNMCI_0EncListBURIEncounters0C3151C405 ,
			eval((getIdListFromClinicalStatementList(
				$Encs_EFNLREDNMCI_0EncListBURIEncounters0C3151C405)).contains(sourceId)),
			targetId memberOf $EncProbIds_EFNLREDNMCI_0EncListBURIEncounters0C3151C405 ),
		 		init (ArrayList $TempIds = new ArrayList(); 
), action ($TempIds.add($TempId); 
), reverse ($TempIds.remove($TempId); 
), result($TempIds) 		) and EncListB : 
	java.util.List (size >= 0 ) from accumulate  		(
  		$TempId : EncounterEvent 			(

), 		init (ArrayList $TempIds = new ArrayList(); 
), action ($TempIds.add($TempId); 
), reverse ($TempIds.remove($TempId); 
), result($TempIds) 		) ) //DslUsed==Enc.From.NamedList.After.EncDx.Count.Id|||INT1==0|||ENCLISTID==EncListB|||NAMEDLIST==URIEncounters|||INT2==0|||PROB==C3151|||CSREL=C405
	then
		namedObjects.put('MultipleClaims', EncListB); 
NamedList  $namedListEncListB = new NamedList(); 
$namedListEncListB.setName('MultipleClaims'); 
$namedListEncListB.setList(EncListB); 
 insert ($namedListEncListB); 
//DslUsed==Insert.EncListRef.As.NamedList.Dsl|||ENCLISTID==EncListB|||NAME==MultipleClaims
end


rule "I.02 ExcludeMedicationActive"
	ruleflow-group "denominatorExclusions"
	dialect "java"
	when
		( EvalTime($evalTime : evalTimeValue) and 
			FocalPersonId($focalPersonId : id) and 
			FocalPersonId($evaluatedPersonId : id) )
		( 	Assertion(value == "C545") ) //DslUsed==Assertion.Exists.Dsl|||ASSERTION==C545
		 not (
		( 	NamedList 	(
		  		name == "MedicationActive",
		   		list != null, EncListA : list == ( (List) 
						 (namedObjects.get("MedicationActive"))) 	) ) //DslUsed==NamedList.Exists.EncListId.Dsl|||ENCLISTID==EncListA|||NAME==MedicationActive
		 )
( 	$EFNAMSDDSACI_MedConceptTargetIds_0EncListBURIEncounters05C2847 : 
java.util.List (size >= 0 ) from accumulate  	(
	MedicationConcept 		(
		openCdsConceptCode == "C2847",
	ESMPBECI_MedConceptTargetId_0EncListBURIEncounters05C2847 : 
conceptTargetId  		), 	init (
	ArrayList 
		$EFNAMSDDSACI_TempMedConceptTargetIds_0EncListBURIEncounters05C2847
			   = new ArrayList(); 
), 	action (
	$EFNAMSDDSACI_TempMedConceptTargetIds_0EncListBURIEncounters05C2847.add(
	ESMPBECI_MedConceptTargetId_0EncListBURIEncounters05C2847); 
), 	reverse (
	$EFNAMSDDSACI_TempMedConceptTargetIds_0EncListBURIEncounters05C2847.remove(
	ESMPBECI_MedConceptTargetId_0EncListBURIEncounters05C2847); 
), 	result ($EFNAMSDDSACI_TempMedConceptTargetIds_0EncListBURIEncounters05C2847)
	 	) and 	
	$EFNAMSDDSACI_SubDispenseEvents_0EncListBURIEncounters05C2847 : 
		java.util.List  (size >= 0) from collect  	(
	SubstanceDispensationEvent 		(
		evaluatedPersonId == $evaluatedPersonId,
		id memberOf 
				$EFNAMSDDSACI_MedConceptTargetIds_0EncListBURIEncounters05C2847,
		dispensationTime != null,
		daysSupply != null 		) 	) and
	 	NamedList 	(
	 		name == "URIEncounters",
	  		list != null,
	 		list.size() >= 0,
	 		$EFNAMSDDSACI_Encounters_0EncListBURIEncounters05C2847 : 
				list == ( (List) (namedObjects.get("URIEncounters")))
					 	) and EncListB : 
			java.util.List (size >= 0 ) from accumulate  	(
			  		$EFNAMSDDSACI_Enc_0EncListBURIEncounters05C2847 : 
			EncounterEvent 		(
			  			evaluatedPersonId == $evaluatedPersonId,
	eval(encInEncList($EFNAMSDDSACI_Enc_0EncListBURIEncounters05C2847, 
		$EFNAMSDDSACI_Encounters_0EncListBURIEncounters05C2847,namedObjects)), 			
		eval(encAfterMedSubDispenseDaysSupplyActiveFromListWithinTime(
		$EFNAMSDDSACI_Enc_0EncListBURIEncounters05C2847, 
		$EFNAMSDDSACI_SubDispenseEvents_0EncListBURIEncounters05C2847 ,
				"Low",0,5,namedObjects
			))  		), 	init (
		ArrayList $EFNAMSDDSACI_TempFinalEncs_0EncListBURIEncounters05C2847 
					= new ArrayList(); 
), 	action ( $EFNAMSDDSACI_TempFinalEncs_0EncListBURIEncounters05C2847.add(
	$EFNAMSDDSACI_Enc_0EncListBURIEncounters05C2847); 
), 	reverse ( $EFNAMSDDSACI_TempFinalEncs_0EncListBURIEncounters05C2847.remove(
	$EFNAMSDDSACI_Enc_0EncListBURIEncounters05C2847); 
), 	result( $EFNAMSDDSACI_TempFinalEncs_0EncListBURIEncounters05C2847) 	) 	  ) //DslUsed==Enc.From.NamedList.After.Med.SubDispense.DaysSupply.Active.Count.Id|||INT1==0|||ENCLISTID==EncListB|||NAMEDLIST==URIEncounters|||INT2==0|||TIMEUNITS2==5|||MED==C2847
	then
		namedObjects.put('MedicationActive', EncListB); 
NamedList  $namedListEncListB = new NamedList(); 
$namedListEncListB.setName('MedicationActive'); 
$namedListEncListB.setList(EncListB); 
 insert ($namedListEncListB); 
//DslUsed==Insert.EncListRef.As.NamedList.Dsl|||ENCLISTID==EncListB|||NAME==MedicationActive
end


rule "I.03 ExcludeMedicationDispensed"
	ruleflow-group "denominatorExclusions"
	dialect "java"
	when
		( EvalTime($evalTime : evalTimeValue) and 
			FocalPersonId($focalPersonId : id) and 
			FocalPersonId($evaluatedPersonId : id) )
		( 	Assertion(value == "C545") ) //DslUsed==Assertion.Exists.Dsl|||ASSERTION==C545
		 not (
		( 	NamedList 	( 		name == "MedicationDispensed",  		list != null, EncListA : list == ( (List) (namedObjects.get("MedicationDispensed"))) 	) ) //DslUsed==NamedList.Exists.EncListId.Dsl|||ENCLISTID==EncListA|||NAME==MedicationDispensed
		 )
		( 	$EFNAMSDCI_MedConceptTargetIds_0EncListBURIEncounters305C2847 : 
			java.util.List (size >= 0 ) from accumulate  	(
			    		MedicationConcept 		(
			    			openCdsConceptCode == "C2847",
			   			ESMPBECI_MedConceptTargetId_0EncListBURIEncounters305C2847 : 
					conceptTargetId  		), 	init (ArrayList 
			  $EFNAMSDCI_TempMedConceptTargetIds_0EncListBURIEncounters305C2847
			   = new ArrayList(); 
), 	action (
	$EFNAMSDCI_TempMedConceptTargetIds_0EncListBURIEncounters305C2847.add(
	ESMPBECI_MedConceptTargetId_0EncListBURIEncounters305C2847); 
), 	reverse (
	$EFNAMSDCI_TempMedConceptTargetIds_0EncListBURIEncounters305C2847.remove(
	ESMPBECI_MedConceptTargetId_0EncListBURIEncounters305C2847); 
), 	result (
	$EFNAMSDCI_TempMedConceptTargetIds_0EncListBURIEncounters305C2847) 	) and
	 	$EFNAMSDCI_SubDispenseEvents_0EncListBURIEncounters305C2847 : 
			java.util.List  (size >= 0) from collect  	(
	SubstanceDispensationEvent 		(
		evaluatedPersonId == $evaluatedPersonId,
		id memberOf 
			$EFNAMSDCI_MedConceptTargetIds_0EncListBURIEncounters305C2847,
		dispensationTime != null
	) 	) and 	NamedList 	(
	name == "URIEncounters",  		list != null, 		list.size() >= 0,
		 		$EFNAMSDCI_Encounters_0EncListBURIEncounters305C2847 : 
list == ( (List) (namedObjects.get("URIEncounters")))
				 	) and EncListB : 
java.util.List (size >= 0 ) from accumulate  	(
	$EFNAMSDCI_Enc_0EncListBURIEncounters305C2847 : EncounterEvent 		(
		evaluatedPersonId == $evaluatedPersonId,
	eval(encInEncList($EFNAMSDCI_Enc_0EncListBURIEncounters305C2847, 
		$EFNAMSDCI_Encounters_0EncListBURIEncounters305C2847,namedObjects)),
		 			eval(encAfterMedSubDispenseFromListWithinTime(
		$EFNAMSDCI_Enc_0EncListBURIEncounters305C2847, 
		$EFNAMSDCI_SubDispenseEvents_0EncListBURIEncounters305C2847 ,
		"Low","Low",30,5,namedObjects))
		  		), 	init (ArrayList 
		$EFNAMSDCI_TempFinalEncs_0EncListBURIEncounters305C2847 = new ArrayList(); 
), 	action ( $EFNAMSDCI_TempFinalEncs_0EncListBURIEncounters305C2847.add(
	$EFNAMSDCI_Enc_0EncListBURIEncounters305C2847); 
), 	reverse ( $EFNAMSDCI_TempFinalEncs_0EncListBURIEncounters305C2847.remove(
	$EFNAMSDCI_Enc_0EncListBURIEncounters305C2847); 
), 	result( $EFNAMSDCI_TempFinalEncs_0EncListBURIEncounters305C2847) 	)  ) //DslUsed==Enc.From.NamedList.After.Med.SubDispense.Count.Id|||INT1==0|||ENCLISTID==EncListB|||NAMEDLIST==URIEncounters|||INT2==30|||TIMEUNITS2==5|||MED==C2847
	then
		namedObjects.put('MedicationDispensed', EncListB); 
NamedList  $namedListEncListB = new NamedList(); 
$namedListEncListB.setName('MedicationDispensed'); 
$namedListEncListB.setList(EncListB); 
 insert ($namedListEncListB); 
//DslUsed==Insert.EncListRef.As.NamedList.Dsl|||ENCLISTID==EncListB|||NAME==MedicationDispensed
end


rule "I.04 ExcludePharyngitisCompetingDx"
	ruleflow-group "denominatorExclusions"
	dialect "java"
	when
		( EvalTime($evalTime : evalTimeValue) and 
			FocalPersonId($focalPersonId : id) and 
			FocalPersonId($evaluatedPersonId : id) )
		( 	Assertion(value == "C545") ) //DslUsed==Assertion.Exists.Dsl|||ASSERTION==C545
		 not (
		( 	NamedList 	(
			 name == "PharyngitisCompetingDx",  		
			 list != null, EncListA : list == ( (List)
				   (namedObjects.get("PharyngitisCompetingDx"))) 	) ) //DslUsed==NamedList.Exists.EncListId.Dsl|||ENCLISTID==EncListA|||NAME==PharyngitisCompetingDx
		 )
		( 	$EFNAERECI_ProbConceptTargetIds_0EncListBURIEncounters305C3141C405 : 
			java.util.List (size >= 0 ) from accumulate  	(
		  		ProblemConcept 		(
		  		openCdsConceptCode == "C3141",
		 		$EFNAERECI_ProbConceptTargetId_0EncListBURIEncounters305C3141C405 : 
					conceptTargetId  		), 	init (ArrayList 
				$EFNAERECI_TempProbConceptTargetIds_0EncListBURIEncounters305C3141C405
				 = new ArrayList(); 
), 	action (
	$EFNAERECI_TempProbConceptTargetIds_0EncListBURIEncounters305C3141C405.add(
	$EFNAERECI_ProbConceptTargetId_0EncListBURIEncounters305C3141C405); 
), 	reverse (
	$EFNAERECI_TempProbConceptTargetIds_0EncListBURIEncounters305C3141C405.remove(
	$EFNAERECI_ProbConceptTargetId_0EncListBURIEncounters305C3141C405); 
), 	result(
	$EFNAERECI_TempProbConceptTargetIds_0EncListBURIEncounters305C3141C405) 	) and
	   	$EFNAERECI_CSRelConceptProbTargetIds_0EncListBURIEncounters305C3141C405 : 
java.util.List (size >= 0 ) from accumulate  	(
	  		ClinicalStatementRelationshipConcept 		(
	  		openCdsConceptCode == "C405",
	 		$EFNAERECI_CSRelConceptProbTargetId_0EncListBURIEncounters305C3141C405 :
 conceptTargetId  		), 	init (ArrayList 
	$EFNAERECI_TempCSRelConceptProbTargetIds_0EncListBURIEncounters305C3141C405 
		= new ArrayList(); 
), 	action ( 
	$EFNAERECI_TempCSRelConceptProbTargetIds_0EncListBURIEncounters305C3141C405.add(
	$EFNAERECI_CSRelConceptProbTargetId_0EncListBURIEncounters305C3141C405); 
), 	reverse ( 
	$EFNAERECI_TempCSRelConceptProbTargetIds_0EncListBURIEncounters305C3141C405.remove(
	$EFNAERECI_CSRelConceptProbTargetId_0EncListBURIEncounters305C3141C405); 
), 	result(
	$EFNAERECI_TempCSRelConceptProbTargetIds_0EncListBURIEncounters305C3141C405) 	) and
	   	$EFNAERECI_CSRelProbSourceIds_0EncListBURIEncounters305C3141C405 : 
java.util.List (size >= 0 ) from accumulate  	(
	  		ClinicalStatementRelationship 		(
	  		id memberOf 
				$EFNAERECI_CSRelConceptProbTargetIds_0EncListBURIEncounters305C3141C405,
	 		targetId memberOf 
					$EFNAERECI_ProbConceptTargetIds_0EncListBURIEncounters305C3141C405,
	 		$EFNAERECI_CSRelProbSourceId_0EncListBURIEncounters305C3141C405 : 
			sourceId  		), 	init (ArrayList 
		$EFNAERECI_TempCSRelProbSourceIds_0EncListBURIEncounters305C3141C405 
		= new ArrayList(); 
), 	action ( 
	$EFNAERECI_TempCSRelProbSourceIds_0EncListBURIEncounters305C3141C405.add(
	$EFNAERECI_CSRelProbSourceId_0EncListBURIEncounters305C3141C405); 
), 	reverse ( 
	$EFNAERECI_TempCSRelProbSourceIds_0EncListBURIEncounters305C3141C405.remove(
	$EFNAERECI_CSRelProbSourceId_0EncListBURIEncounters305C3141C405); 
), 	result( 
	$EFNAERECI_TempCSRelProbSourceIds_0EncListBURIEncounters305C3141C405) 	) and
	   	$EFNAERECI_ComorbidEncIds_0EncListBURIEncounters305C3141C405 : 
java.util.List (size >= 0 ) from accumulate  	(
	  		EncounterEvent 		(
	 		 			$EFNAERECI_ComorbidEncId_0EncListBURIEncounters305C3141C405 : 
id memberOf $EFNAERECI_CSRelProbSourceIds_0EncListBURIEncounters305C3141C405,
	  			evaluatedPersonId == $evaluatedPersonId 		),
	 	init (ArrayList 
			$EFNAERECI_TempComorbidEncIds_0EncListBURIEncounters305C3141C405 
			= new ArrayList(); 
), 	action ( 
	$EFNAERECI_TempComorbidEncIds_0EncListBURIEncounters305C3141C405.add(
	$EFNAERECI_ComorbidEncId_0EncListBURIEncounters305C3141C405); 
), 	reverse ( 
	$EFNAERECI_TempComorbidEncIds_0EncListBURIEncounters305C3141C405.remove(
	$EFNAERECI_ComorbidEncId_0EncListBURIEncounters305C3141C405); 
), 	result( 
	$EFNAERECI_TempComorbidEncIds_0EncListBURIEncounters305C3141C405) 	) and
	   	$EFNAERECI_ComorbidEncs_0EncListBURIEncounters305C3141C405 : 
		java.util.List( size >= 0 ) from collect  	(
			EncounterEvent 		(
	 			id memberOf 
					$EFNAERECI_ComorbidEncIds_0EncListBURIEncounters305C3141C405 
					) 	) and
		 		NamedList 	(
 					name == "URIEncounters",
			  		list != null,
					list.size() >= 0,
	 		$EFNAERECI_Encounters_0EncListBURIEncounters305C3141C405 : 
list == ( (List) (namedObjects.get("URIEncounters"))) 	) and EncListB : 
java.util.List (size >= 0 ) from accumulate  	(
				  		$EFNAERECI_Enc_0EncListBURIEncounters305C3141C405 : 
	EncounterEvent 		(
		evaluatedPersonId == $evaluatedPersonId,
		eval(encInEncList($EFNAERECI_Enc_0EncListBURIEncounters305C3141C405, 
			$EFNAERECI_Encounters_0EncListBURIEncounters305C3141C405,
			namedObjects)),
( 	eval(encAfterEncFromListWithinTime(
		$EFNAERECI_Enc_0EncListBURIEncounters305C3141C405, 
		$EFNAERECI_ComorbidEncs_0EncListBURIEncounters305C3141C405,
						"Low","High",30,5,namedObjects))
		  			||
		  			eval(encBeforeEncFromListWithinTime(
		$EFNAERECI_Enc_0EncListBURIEncounters305C3141C405, 
		$EFNAERECI_ComorbidEncs_0EncListBURIEncounters305C3141C405,
									"High","Low",8,5,namedObjects)
		) 			) 		), 	init (
	ArrayList 
		$EFNAERECI_TempFinalEncs_0EncListBURIEncounters305C3141C405 
				= new ArrayList(); 
), 	action ( 
	$EFNAERECI_TempFinalEncs_0EncListBURIEncounters305C3141C405.add(
	$EFNAERECI_Enc_0EncListBURIEncounters305C3141C405); 
), 	reverse ( 
	$EFNAERECI_TempFinalEncs_0EncListBURIEncounters305C3141C405.remove(
	$EFNAERECI_Enc_0EncListBURIEncounters305C3141C405); 
), 	result( $EFNAERECI_TempFinalEncs_0EncListBURIEncounters305C3141C405
	) 	)  )  //DslUsed==Enc.From.NamedList.Before.After.Enc.Rship.EncDx.Count.Id|||INT1==0|||ENCLISTID==EncListB|||NAMEDLIST==URIEncounters|||INT2==30|||TIMEUNITS2==5|||INT3==8|||TIMEUNITS3==5|||PROB==C3141|||CSREL=C405
	then
		namedObjects.put('PharyngitisCompetingDx', EncListB); 
NamedList  $namedListEncListB = new NamedList(); 
$namedListEncListB.setName('PharyngitisCompetingDx'); 
$namedListEncListB.setList(EncListB); 
 insert ($namedListEncListB); 
//DslUsed==Insert.EncListRef.As.NamedList.Dsl|||ENCLISTID==EncListB|||NAME==PharyngitisCompetingDx
end


rule "I.05 ExcludeOtherCompetingDx"
	ruleflow-group "denominatorExclusions"
	dialect "java"
	when
		( EvalTime($evalTime : evalTimeValue) and 
			FocalPersonId($focalPersonId : id) and 
			FocalPersonId($evaluatedPersonId : id) )
		( 	Assertion(value == "C545") ) //DslUsed==Assertion.Exists.Dsl|||ASSERTION==C545
		 not (
		( 	NamedList 	(
		  		name == "OtherCompetingDx",
		   		list != null, 
				EncListA : list == ( (List) (namedObjects.get("OtherCompetingDx")))
						  	) )
						  //DslUsed==NamedList.Exists.EncListId.Dsl|||ENCLISTID==EncListA|||NAME==OtherCompetingDx
		 )
		( 	
	  $EFNAERECI_ProbConceptTargetIds_0EncListBURIEncounters305C3093C405 : 
		java.util.List (size >= 0 ) from accumulate  	(
	ProblemConcept 		(
	openCdsConceptCode == "C3093",
	$EFNAERECI_ProbConceptTargetId_0EncListBURIEncounters305C3093C405 : 
		conceptTargetId  		), 	init (ArrayList 
			$EFNAERECI_TempProbConceptTargetIds_0EncListBURIEncounters305C3093C405 
	  		  = new ArrayList(); 
), 	action (
	$EFNAERECI_TempProbConceptTargetIds_0EncListBURIEncounters305C3093C405.add(
	$EFNAERECI_ProbConceptTargetId_0EncListBURIEncounters305C3093C405); 
), 	reverse (
	$EFNAERECI_TempProbConceptTargetIds_0EncListBURIEncounters305C3093C405.remove(
	$EFNAERECI_ProbConceptTargetId_0EncListBURIEncounters305C3093C405); 
), 	result(
	$EFNAERECI_TempProbConceptTargetIds_0EncListBURIEncounters305C3093C405) 	) and
	   	$EFNAERECI_CSRelConceptProbTargetIds_0EncListBURIEncounters305C3093C405 : 
java.util.List (size >= 0 ) from accumulate  	(
	  		ClinicalStatementRelationshipConcept 		(
	  		openCdsConceptCode == "C405",
	 		$EFNAERECI_CSRelConceptProbTargetId_0EncListBURIEncounters305C3093C405 : 
conceptTargetId  		), 	init (ArrayList 
	$EFNAERECI_TempCSRelConceptProbTargetIds_0EncListBURIEncounters305C3093C405 
		= new ArrayList(); 
), 	action ( 
	$EFNAERECI_TempCSRelConceptProbTargetIds_0EncListBURIEncounters305C3093C405.add(
	$EFNAERECI_CSRelConceptProbTargetId_0EncListBURIEncounters305C3093C405); 
), 	reverse ( 
	$EFNAERECI_TempCSRelConceptProbTargetIds_0EncListBURIEncounters305C3093C405.remove(
	$EFNAERECI_CSRelConceptProbTargetId_0EncListBURIEncounters305C3093C405); 
), 	result($EFNAERECI_TempCSRelConceptProbTargetIds_0EncListBURIEncounters305C3093C405)
	 	) and
	   	$EFNAERECI_CSRelProbSourceIds_0EncListBURIEncounters305C3093C405 : 
		java.util.List (size >= 0 ) from accumulate  	(
	ClinicalStatementRelationship 		(
	id memberOf 
		$EFNAERECI_CSRelConceptProbTargetIds_0EncListBURIEncounters305C3093C405,
	targetId memberOf 
		$EFNAERECI_ProbConceptTargetIds_0EncListBURIEncounters305C3093C405,
	$EFNAERECI_CSRelProbSourceId_0EncListBURIEncounters305C3093C405 : sourceId
		  		), 	init (ArrayList 
		$EFNAERECI_TempCSRelProbSourceIds_0EncListBURIEncounters305C3093C405 
		= new ArrayList(); 
), 	action ( 
	$EFNAERECI_TempCSRelProbSourceIds_0EncListBURIEncounters305C3093C405.add(
	$EFNAERECI_CSRelProbSourceId_0EncListBURIEncounters305C3093C405); 
), 	reverse ( 
	$EFNAERECI_TempCSRelProbSourceIds_0EncListBURIEncounters305C3093C405.remove(
	$EFNAERECI_CSRelProbSourceId_0EncListBURIEncounters305C3093C405); 
), 	result( 
	$EFNAERECI_TempCSRelProbSourceIds_0EncListBURIEncounters305C3093C405) 	) and
	   	$EFNAERECI_ComorbidEncIds_0EncListBURIEncounters305C3093C405 : 
java.util.List (size >= 0 ) from accumulate  	(
	  		EncounterEvent 		( 		 			
	$EFNAERECI_ComorbidEncId_0EncListBURIEncounters305C3093C405 : 
id memberOf $EFNAERECI_CSRelProbSourceIds_0EncListBURIEncounters305C3093C405,
	  			evaluatedPersonId == $evaluatedPersonId
	 		), 	init (ArrayList 
	$EFNAERECI_TempComorbidEncIds_0EncListBURIEncounters305C3093C405 
					= new ArrayList(); 
), 	action ( 
	$EFNAERECI_TempComorbidEncIds_0EncListBURIEncounters305C3093C405.add(
	$EFNAERECI_ComorbidEncId_0EncListBURIEncounters305C3093C405); 
), 	reverse ( 
	$EFNAERECI_TempComorbidEncIds_0EncListBURIEncounters305C3093C405.remove(
	$EFNAERECI_ComorbidEncId_0EncListBURIEncounters305C3093C405); 
), 	result( 
	$EFNAERECI_TempComorbidEncIds_0EncListBURIEncounters305C3093C405) 	) and
	   	$EFNAERECI_ComorbidEncs_0EncListBURIEncounters305C3093C405 : 
java.util.List( size >= 0 ) from collect  	(
	  		EncounterEvent 		(
	 			id memberOf 
	$EFNAERECI_ComorbidEncIds_0EncListBURIEncounters305C3093C405 ) 	) and
	 		NamedList 	(
	 		name == "URIEncounters",
	  		list != null,
	 		list.size() >= 0, 		
	$EFNAERECI_Encounters_0EncListBURIEncounters305C3093C405 : 
list == ( (List) (namedObjects.get("URIEncounters"))) 	) and EncListB : 
java.util.List (size >= 0 ) from accumulate  	(
		  		$EFNAERECI_Enc_0EncListBURIEncounters305C3093C405 : 
	EncounterEvent 		(
		evaluatedPersonId == $evaluatedPersonId,
		eval(encInEncList($EFNAERECI_Enc_0EncListBURIEncounters305C3093C405, 
		$EFNAERECI_Encounters_0EncListBURIEncounters305C3093C405,namedObjects)), 			(
		eval(encAfterEncFromListWithinTime(
			$EFNAERECI_Enc_0EncListBURIEncounters305C3093C405, 
			$EFNAERECI_ComorbidEncs_0EncListBURIEncounters305C3093C405,
				"Low","High",30,5,namedObjects))
			  			||
			  			eval(encBeforeEncFromListWithinTime(
			$EFNAERECI_Enc_0EncListBURIEncounters305C3093C405, 
			$EFNAERECI_ComorbidEncs_0EncListBURIEncounters305C3093C405,
							"High","Low",8,5,namedObjects)
			) 			) 		), 	init (
			ArrayList 
			$EFNAERECI_TempFinalEncs_0EncListBURIEncounters305C3093C405 
				= new ArrayList(); 
), 	action ( 
	$EFNAERECI_TempFinalEncs_0EncListBURIEncounters305C3093C405.add(
	$EFNAERECI_Enc_0EncListBURIEncounters305C3093C405); 
), 	reverse ( 
	$EFNAERECI_TempFinalEncs_0EncListBURIEncounters305C3093C405.remove(
	$EFNAERECI_Enc_0EncListBURIEncounters305C3093C405); 
), 	result( $EFNAERECI_TempFinalEncs_0EncListBURIEncounters305C3093C405) 	)  ) //DslUsed==Enc.From.NamedList.Before.After.Enc.Rship.EncDx.Count.Id|||INT1==0|||ENCLISTID==EncListB|||NAMEDLIST==URIEncounters|||INT2==30|||TIMEUNITS2==5|||INT3==8|||TIMEUNITS3==5|||PROB==C3093|||CSREL=C405
	then
		namedObjects.put('OtherCompetingDx', EncListB); 
NamedList  $namedListEncListB = new NamedList(); 
$namedListEncListB.setName('OtherCompetingDx'); 
$namedListEncListB.setList(EncListB); 
 insert ($namedListEncListB); 
//DslUsed==Insert.EncListRef.As.NamedList.Dsl|||ENCLISTID==EncListB|||NAME==OtherCompetingDx
end


rule "I.06 ListAllExclusions"
	ruleflow-group "denominatorExclusions"
	dialect "java"
	when
		( EvalTime($evalTime : evalTimeValue) and 
			FocalPersonId($focalPersonId : id) and 
			FocalPersonId($evaluatedPersonId : id) )
		( 	Assertion(value == "C545") ) //DslUsed==Assertion.Exists.Dsl|||ASSERTION==C545
		 not (
		( 	NamedList 	(
	  		name == "AllExclusions",
			list != null, 
			EncListA : list == ( (List) (namedObjects.get("AllExclusions"))) 	) ) //DslUsed==NamedList.Exists.EncListId.Dsl|||ENCLISTID==EncListA|||NAME==AllExclusions
		 )
	( 	NamedList 	(
  		name == "MultipleClaims",
   		list != null, 
		EncListB : list == ( (List) (namedObjects.get("MultipleClaims"))) 	) ) //DslUsed==NamedList.Exists.EncListId.Dsl|||ENCLISTID==EncListB|||NAME==MultipleClaims
	( 	NamedList 	(
  		name == "MedicationActive",
   		list != null, 
		EncListC : list == ( (List) (namedObjects.get("MedicationActive"))) 
						 	) ) //DslUsed==NamedList.Exists.EncListId.Dsl|||ENCLISTID==EncListC|||NAME==MedicationActive
	( 	NamedList 	(
  		name == "MedicationDispensed",
   		list != null, 
		EncListD : list == ( (List) (namedObjects.get("MedicationDispensed"))) 
		 	) ) //DslUsed==NamedList.Exists.EncListId.Dsl|||ENCLISTID==EncListD|||NAME==MedicationDispensed
	( 	NamedList 	(
  		name == "PharyngitisCompetingDx",
   		list != null, 
		EncListE : list == ( (List) (namedObjects.get("PharyngitisCompetingDx"))) 
				 	) ) //DslUsed==NamedList.Exists.EncListId.Dsl|||ENCLISTID==EncListE|||NAME==PharyngitisCompetingDx
	( 	NamedList 	(
		list != null, 
		name == "OtherCompetingDx",
		EncListF : list == ( (List) (namedObjects.get("OtherCompetingDx")))
					  	) ) //DslUsed==NamedList.Exists.EncListId.Dsl|||ENCLISTID==EncListF|||NAME==OtherCompetingDx
	then
		List EncListG = new ArrayList(); 
EncListG.addAll(EncListB); 
EncListG.addAll(EncListC); 
//DslUsed==Set.EncListId.Add.EncListRefs.Dsl|||ENCLISTID1==EncListG|||ENCLISTID2==EncListB|||ENCLISTID3==EncListC
		List EncListH = new ArrayList(); 
EncListH.addAll(EncListD); 
EncListH.addAll(EncListE); 
//DslUsed==Set.EncListId.Add.EncListRefs.Dsl|||ENCLISTID1==EncListH|||ENCLISTID2==EncListD|||ENCLISTID3==EncListE
		List EncListI = new ArrayList(); 
EncListI.addAll(EncListF); 
EncListI.addAll(EncListG); 
//DslUsed==Set.EncListId.Add.EncListRefs.Dsl|||ENCLISTID1==EncListI|||ENCLISTID2==EncListF|||ENCLISTID3==EncListG
		List EncListJ = new ArrayList(); 
EncListJ.addAll(EncListI); 
EncListJ.addAll(EncListH); 
//DslUsed==Set.EncListId.Add.EncListRefs.Dsl|||ENCLISTID1==EncListJ|||ENCLISTID2==EncListI|||ENCLISTID3==EncListH
		namedObjects.put('AllExclusions', EncListJ); 
NamedList  $namedListEncListJ = new NamedList(); 
$namedListEncListJ.setName('AllExclusions'); 
$namedListEncListJ.setList(EncListJ); 
 insert ($namedListEncListJ); 
//DslUsed==Insert.EncListRef.As.NamedList.Dsl|||ENCLISTID==EncListJ|||NAME==AllExclusions
end


rule "I.07 ListEligibleEncounters"
	ruleflow-group "denominatorExclusions"
	dialect "java"
	when
		( EvalTime($evalTime : evalTimeValue) and 
			FocalPersonId($focalPersonId : id) and 
			FocalPersonId($evaluatedPersonId : id) )
		( 	Assertion(value == "C545") ) //DslUsed==Assertion.Exists.Dsl|||ASSERTION==C545
		 not (
		( 	NamedEncounter 	( 		name == "EligibleEncounters",  		encounter != null, 		namedObjects.get("EligibleEncounters") != null,  		encounter.id == ((EncounterEvent) namedObjects.get("EligibleEncounters")).getId()	 	) ) //DslUsed==NamedEncounter.Exists.Not.Null.Dsl|||NAME==EligibleEncounters
		 )
		( 	NamedList 	( 		name == "URIEncounters",  		list != null, EncListA : list == ( (List) (namedObjects.get("URIEncounters"))) 	) ) //DslUsed==NamedList.Exists.EncListId.Dsl|||ENCLISTID==EncListA|||NAME==URIEncounters
		( 	NamedList 	( 		name == "AllExclusions",  		list != null, EncListB : list == ( (List) (namedObjects.get("AllExclusions"))) 	) ) //DslUsed==NamedList.Exists.EncListId.Dsl|||ENCLISTID==EncListB|||NAME==AllExclusions
	then
		List EncListC = getEncListWithNoTimeOverlap(EncListA, EncListB); 
//DslUsed==Set.EncListId.EncListRefs.No.Time.Overlap.Dsl|||ENCLISTID1==EncListC|||ENCLISTID2==EncListA|||ENCLISTID3==EncListB
		namedObjects.put('EligibleEncounters', EncListC); 
NamedList  $namedListEncListC = new NamedList(); 
$namedListEncListC.setName('EligibleEncounters'); 
$namedListEncListC.setList(EncListC); 
 insert ($namedListEncListC); 
//DslUsed==Insert.EncListRef.As.NamedList.Dsl|||ENCLISTID==EncListC|||NAME==EligibleEncounters
end


rule "K.01 DenominatorCriteriaMet"
	ruleflow-group "denominatorConclusion"
	dialect "java"
	when
		( EvalTime($evalTime : evalTimeValue) and 
			FocalPersonId($focalPersonId : id) and 
			FocalPersonId($evaluatedPersonId : id) )
		( 	Assertion(value == "C545") ) //DslUsed==Assertion.Exists.Dsl|||ASSERTION==C545
		(    java.util.List (size == 0) from collect (
				 Assertion(value == "C544") )  ) //DslUsed==Assertion.Not.Exists.Dsl|||ASSERTION==C544
		( 	NamedList 	(
		  		name == "EligibleEncounters",
		   		list != null, 
				list.size() > 0,
				list == ( (List) (namedObjects.get("EligibleEncounters"))) 	) ) //DslUsed==NamedList.Exists.Not.Empty.Dsl|||NAME==EligibleEncounters
		 not (
		( 	NamedDate 	( 		name == "IESD",  		date != null, 		date == ((java.util.Date) namedObjects.get("IESD")) 	) ) //DslUsed==NamedDate.Exists.Not.Null.Dsl|||NAME==IESD
		 )
	then
		insert(new Assertion("C54")); 
assertions.add("C54"); 
//DslUsed==Assert.Dsl|||ASSERTION==C54
List<EncounterEvent> namedListEncs = 
	(List<EncounterEvent>) namedObjects.get("EligibleEncounters"); 
java.util.Date namedDateValue = getEarliestDateFromEncounterList(namedListEncs, "Low"); 
namedObjects.put("IESD", namedDateValue); 
NamedDate $INDFEEINL_NamedDate = new NamedDate(); 
$INDFEEINL_NamedDate.setName("IESD"); 
$INDFEEINL_NamedDate.setDate(namedDateValue); 
 insert ($INDFEEINL_NamedDate); 
//DslUsed==Insert.NamedDate.From.Earliest.Enc.In.NamedList.Dsl|||NAME==IESD|||HIGHLOW==Low|||NAMEDLISTNAME==EligibleEncounters
end


rule "K.02  InsertNamedDateIESD_ PLUS_3D"
	ruleflow-group "denominatorConclusion"
	dialect "java"
	when
		( EvalTime($evalTime : evalTimeValue) and 
			FocalPersonId($focalPersonId : id) and 
			FocalPersonId($evaluatedPersonId : id) )
		( 	Assertion(value == "C54") ) //DslUsed==Assertion.Exists.Dsl|||ASSERTION==C54
		( 	NamedDate 	( 		name == "IESD",  		date != null, 		date == ((java.util.Date) namedObjects.get("IESD")) 	) ) //DslUsed==NamedDate.Exists.Not.Null.Dsl|||NAME==IESD
		 not (
		( 	NamedDate 	( 		name == "IESD_PLUS_3D",  		date != null, 		date == ((java.util.Date) namedObjects.get("IESD_PLUS_3D")) 	) ) //DslUsed==NamedDate.Exists.Not.Null.Dsl|||NAME==IESD_PLUS_3D
		 )
	then 
java.util.Date sourcenamedDateValue_INDAND_35 = 
				  (java.util.Date) namedObjects.get("IESD"); 
java.util.Date namedDateValue_INDAND_35 = 
			  org.opencds.common.utilities.DateUtility.getInstance()
			  .getDateAfterAddingTime(sourcenamedDateValue_INDAND_35, 5, 3); 
namedObjects.put("IESD_PLUS_3D", namedDateValue_INDAND_35); 
NamedDate $namedDateAfterNamedDate_INDAND_35 = new NamedDate(); 
$namedDateAfterNamedDate_INDAND_35.setName("IESD_PLUS_3D"); 
$namedDateAfterNamedDate_INDAND_35.setDate(namedDateValue_INDAND_35); 
insert ($namedDateAfterNamedDate_INDAND_35); 
//DslUsed==Insert.NamedDate.After.NamedDate.Dsl|||NAME==IESD_PLUS_3D|||INT==3|||TIMEUNITS==5|||NAMEDDATENAME==IESD
assertions.add("IESD=" 
	+ org.opencds.common.utilities.DateUtility.getInstance()
		.getDateAsSqlLongString(((java.util.Date) namedObjects.get("IESD")))); 
insert(new Assertion("IESD=" 
	+ org.opencds.common.utilities.DateUtility.getInstance()
		.getDateAsSqlLongString(((java.util.Date) namedObjects.get("IESD"))))); 
//DslUsed==Assert.NamedDate.StNum.Dsl|||NAMEDDATENAME==IESD
end


rule "N.01 Num_AntibioticMedication"
	ruleflow-group "numerator"
	dialect "java"
	when
		( EvalTime($evalTime : evalTimeValue) and 
			FocalPersonId($focalPersonId : id) and 
			FocalPersonId($evaluatedPersonId : id) )
		( 	Assertion(value == "C54") ) //DslUsed==Assertion.Exists.Dsl|||ASSERTION==C54
		( 	NamedDate 	(
	 		name == "IESD",
	  		date != null,
	 		$SDMBNDNT_NamedDate1Value_C2847High : 
				date == ((java.util.Date) namedObjects.get("IESD"))
			) and
			 	NamedDate 	(
			 		name == "IESD_PLUS_3D",
			  		date != null,
			 		$SDMBNDNT_NamedDate2Value_C2847High : 
date == ((java.util.Date) namedObjects.get("IESD_PLUS_3D")) 	) and
			 	$SDMBNDNT_MedConceptTargetIds_C2847High : 
java.util.List (size >= 0 ) from accumulate  	(
	  		MedicationConcept 		(
	  			openCdsConceptCode == "C2847",
	 			SDMBNDNT_MedConceptTargetId_C2847High : 
	conceptTargetId  		), 	init (
	ArrayList $SDMBNDNT_TempMedConceptTargetIds_C2847High 
		= new ArrayList(); 
), 	action ($SDMBNDNT_TempMedConceptTargetIds_C2847High.add(
	SDMBNDNT_MedConceptTargetId_C2847High); 
), 	reverse ($SDMBNDNT_TempMedConceptTargetIds_C2847High.remove(
	SDMBNDNT_MedConceptTargetId_C2847High); 
), 	result ($SDMBNDNT_TempMedConceptTargetIds_C2847High) 	) and
	 	$SDMBNDNT_SubDispenseEvents_C2847High : 
			java.util.List  (size > 0) from collect  	(
	  		SubstanceDispensationEvent 		(
	 			evaluatedPersonId == $evaluatedPersonId,  			
	id memberOf $SDMBNDNT_MedConceptTargetIds_C2847High,
	dispensationTime != null,
	(stripTimeComponent(dispensationTime.getHigh())) >=
		(stripTimeComponent($SDMBNDNT_NamedDate1Value_C2847High)),
	(stripTimeComponent(dispensationTime.getHigh())) <=
		(stripTimeComponent($SDMBNDNT_NamedDate2Value_C2847High))
							 	 		) 	) ) //DslUsed==SubDispence.Med.Between.NamedDates.NoTimes|||MED==C2847|||HIGHLOW==High|||COMP1==>=|||COMP2==<=|||NAMEDDATE1NAME==IESD|||NAMEDDATE2NAME==IESD_PLUS_3D
	then
		insert(new Assertion("C1527")); 
assertions.add("C1527"); 
//DslUsed==Assert.Dsl|||ASSERTION==C1527
		insert(new Assertion("C539")); 
assertions.add("C539"); 
//DslUsed==Assert.Dsl|||ASSERTION==C539
end
	
	
rule "S.01 DebugConceptsAll"
	dialect "java"
	ruleflow-group "debug"
	when
		( EvalTime($evalTime : evalTimeValue) and FocalPersonId($focalPersonId : id)
			and FocalPersonId($evaluatedPersonId : id) )
		( $concepts : java.util.Set (size >= 0) from collect (
				 VmrOpenCdsConcept() )  ) //DslUsed==Out.Concepts.All.Read.Dsl
	then
		IVLDate obsTimeDEBUG_CONCEPTS = new IVLDate(); 
 obsTimeDEBUG_CONCEPTS.setLow($evalTime); 
 obsTimeDEBUG_CONCEPTS.setHigh($evalTime); 
 ObservationResult parentObsDEBUG_CONCEPTS = new ObservationResult(); 
 String parentObsDEBUG_CONCEPTSId = "2.16.840.1.113883.3.795.5.1.1^DEBUG_CONCEPTS"; 
 parentObsDEBUG_CONCEPTS.setId(parentObsDEBUG_CONCEPTSId); 
 parentObsDEBUG_CONCEPTS.setEvaluatedPersonId($evaluatedPersonId); 
 parentObsDEBUG_CONCEPTS.setObservationEventTime(obsTimeDEBUG_CONCEPTS); 
 parentObsDEBUG_CONCEPTS.setSubjectIsFocalPerson($evaluatedPersonId == $focalPersonId); 
 CD parentObsDEBUG_CONCEPTSFocus = new CD(); 
 parentObsDEBUG_CONCEPTSFocus.setCodeSystem("2.16.840.1.113883.3.795.12.1.1"); 
 parentObsDEBUG_CONCEPTSFocus.setCodeSystemName("OpenCDS concepts"); 
 parentObsDEBUG_CONCEPTSFocus.setCode("concepts"); 
 parentObsDEBUG_CONCEPTSFocus.setDisplayName("Concepts found in working memory"); 
 parentObsDEBUG_CONCEPTS.setObservationFocus(parentObsDEBUG_CONCEPTSFocus); 
 parentObsDEBUG_CONCEPTS.setClinicalStatementToBeRoot(true); 
 parentObsDEBUG_CONCEPTS.setToBeReturned(true); 
 ObservationValue obsValueDEBUG_CONCEPTS = new ObservationValue(); 
String conceptsAsString = getConceptsAsString($concepts); 
obsValueDEBUG_CONCEPTS.setText(conceptsAsString); 
parentObsDEBUG_CONCEPTS.setObservationValue(obsValueDEBUG_CONCEPTS); 
 insert(parentObsDEBUG_CONCEPTS); 
 namedObjects.put("parentObsDEBUG_CONCEPTS", (Object)parentObsDEBUG_CONCEPTS); 
//DslUsed==Out.Concepts.All.Write.Dsl|||CONCEPTS==DEBUG_CONCEPTS
	end


rule "T.01 Response_DenomNotMet"
	dialect "java"
	ruleflow-group "denomNotMet"
	when
		( EvalTime($evalTime : evalTimeValue) and 
				FocalPersonId($focalPersonId : id) and 
				FocalPersonId($evaluatedPersonId : id) )
	then
		IVLDate obsTimenumerator = new IVLDate(); 
 obsTimenumerator.setLow($evalTime); 
 obsTimenumerator.setHigh($evalTime); 
 ObservationResult childObsnumerator = new ObservationResult(); 
 String childObsnumeratorId = "2.16.840.1.113883.3.795.5.1.1^numerator"; 
 childObsnumerator.setId(childObsnumeratorId); 
 childObsnumerator.setEvaluatedPersonId($evaluatedPersonId); 
 childObsnumerator.setObservationEventTime(obsTimenumerator); 
 childObsnumerator.setSubjectIsFocalPerson($evaluatedPersonId == $focalPersonId); 
 childObsnumerator.setClinicalStatementToBeRoot(false); 
 childObsnumerator.setToBeReturned(true); 
 CD childObsnumeratorFocus = new CD(); 
 childObsnumeratorFocus.setCodeSystem("2.16.840.1.113883.3.795.12.1.1"); 
 childObsnumeratorFocus.setCodeSystemName("OpenCDS concepts"); 
 childObsnumeratorFocus.setCode("C2605"); 
 childObsnumeratorFocus.setDisplayName(getOpenCDSConceptName("C2605")); 
 childObsnumerator.setObservationFocus(childObsnumeratorFocus); 
 int iChildObsnumerator = 0; 
 INT childObsnumeratorIntegerValue = new INT(); 
 childObsnumeratorIntegerValue.setValue(iChildObsnumerator); 
 ObservationValue childObsnumeratorValue = new ObservationValue(); 
 childObsnumeratorValue.setInteger(childObsnumeratorIntegerValue); 
 childObsnumerator.setObservationValue(childObsnumeratorValue); 
 ClinicalStatementRelationship relnumerator = new ClinicalStatementRelationship(); 
 relnumerator.setSourceId("2.16.840.1.113883.3.795.5.1.1^ROOT"); 
 relnumerator.setTargetId("2.16.840.1.113883.3.795.5.1.1^numerator"); 
 CD relnumeratorCode = new CD(); 
 relnumeratorCode.setCodeSystem("2.16.840.1.113883.3.795.12.1.1"); 
 relnumeratorCode.setCodeSystemName("OpenCDS concepts"); 
 relnumeratorCode.setCode("C405"); 
 relnumeratorCode.setDisplayName("Part of"); 
 relnumerator.setTargetRelationshipToSource(relnumeratorCode); 
 java.util.List<RelationshipToSource> childObsnumeratorRelationshipToSources = 
	 new java.util.ArrayList<RelationshipToSource>(); 
 RelationshipToSource childObsnumeratorRelationshipToSource = new RelationshipToSource(); 
 childObsnumeratorRelationshipToSource.setSourceId("2.16.840.1.113883.3.795.5.1.1^ROOT"); 
 childObsnumeratorRelationshipToSource.setRelationshipToSource(relnumeratorCode); 
 childObsnumeratorRelationshipToSources.add(childObsnumeratorRelationshipToSource); 
 childObsnumerator.setRelationshipToSources(childObsnumeratorRelationshipToSources); 
 insert(childObsnumerator); 
 namedObjects.put("childObsnumerator", childObsnumerator); 
 insert(relnumerator); 
 namedObjects.put("relnumerator", relnumerator); 
 IVLDate obsTimedenominator = new IVLDate(); 
 obsTimedenominator.setLow($evalTime); 
 obsTimedenominator.setHigh($evalTime); 
 ObservationResult childObsdenominator = new ObservationResult(); 
 String childObsdenominatorId = "2.16.840.1.113883.3.795.5.1.1^denominator"; 
 childObsdenominator.setId(childObsdenominatorId); 
 childObsdenominator.setEvaluatedPersonId($evaluatedPersonId); 
 childObsdenominator.setObservationEventTime(obsTimedenominator); 
 childObsdenominator.setSubjectIsFocalPerson($evaluatedPersonId == $focalPersonId); 
 childObsdenominator.setClinicalStatementToBeRoot(false); 
 childObsdenominator.setToBeReturned(true); 
 CD childObsdenominatorFocus = new CD(); 
 childObsdenominatorFocus.setCodeSystem("2.16.840.1.113883.3.795.12.1.1"); 
 childObsdenominatorFocus.setCodeSystemName("OpenCDS concepts"); 
 childObsdenominatorFocus.setCode("C2605"); 
 childObsdenominatorFocus.setDisplayName(getOpenCDSConceptName("C2605")); 
 childObsdenominator.setObservationFocus(childObsdenominatorFocus); 
 int iChildObsdenominator = 0; 
 INT childObsdenominatorIntegerValue = new INT(); 
 childObsdenominatorIntegerValue.setValue(iChildObsdenominator); 
 ObservationValue childObsdenominatorValue = new ObservationValue(); 
 childObsdenominatorValue.setInteger(childObsdenominatorIntegerValue); 
 childObsdenominator.setObservationValue(childObsdenominatorValue); 
 ClinicalStatementRelationship reldenominator = new ClinicalStatementRelationship(); 
 reldenominator.setSourceId("2.16.840.1.113883.3.795.5.1.1^ROOT"); 
 reldenominator.setTargetId("2.16.840.1.113883.3.795.5.1.1^denominator"); 
 CD reldenominatorCode = new CD(); 
 reldenominatorCode.setCodeSystem("2.16.840.1.113883.3.795.12.1.1"); 
 reldenominatorCode.setCodeSystemName("OpenCDS concepts"); 
 reldenominatorCode.setCode("C405"); 
 reldenominatorCode.setDisplayName("Part of"); 
 reldenominator.setTargetRelationshipToSource(reldenominatorCode); 
 java.util.List<RelationshipToSource> childObsdenominatorRelationshipToSources = 
	 new java.util.ArrayList<RelationshipToSource>(); 
 RelationshipToSource childObsdenominatorRelationshipToSource = new RelationshipToSource(); 
 childObsdenominatorRelationshipToSource.setSourceId("2.16.840.1.113883.3.795.5.1.1^ROOT"); 
 childObsdenominatorRelationshipToSource.setRelationshipToSource(reldenominatorCode); 
 childObsdenominatorRelationshipToSources.add(childObsdenominatorRelationshipToSource); 
 childObsdenominator.setRelationshipToSources(childObsdenominatorRelationshipToSources); 
 insert(childObsdenominator); 
 namedObjects.put("childObsdenominator", childObsdenominator); 
 insert(reldenominator); 
 namedObjects.put("reldenominator", reldenominator); 
//DslUsed==Out.Nested.Obs.Num.Denom.Dsl|||DENOMVALUE==0|||DENOMID==denominator|||NUMVALUE==0|||NUMID==numerator|||ROOT==ROOT|||OBSFOCUS==C2605
			assertions.add("denomNotMet"); 
insert(new Assertion("denomNotMet")); 
//DslUsed==Assert.String.Dsl|||ASSERTIONSTRING==denomNotMet
			IVLDate obsTimeASSERTROOT = new IVLDate(); 
 obsTimeASSERTROOT.setLow($evalTime); 
 obsTimeASSERTROOT.setHigh($evalTime); 
 ObservationResult parentObsASSERTROOT = new ObservationResult(); 
 String parentObsASSERTROOTId = "2.16.840.1.113883.3.795.5.1.1^ASSERTROOT"; 
 parentObsASSERTROOT.setId(parentObsASSERTROOTId); 
 parentObsASSERTROOT.setEvaluatedPersonId($evaluatedPersonId); 
 parentObsASSERTROOT.setObservationEventTime(obsTimeASSERTROOT); 
 parentObsASSERTROOT.setSubjectIsFocalPerson($evaluatedPersonId == $focalPersonId); 
 CD parentObsASSERTROOTFocus = new CD(); 
 parentObsASSERTROOTFocus.setCodeSystem("2.16.840.1.113883.3.795.12.1.1"); 
 parentObsASSERTROOTFocus.setCodeSystemName("OpenCDS concepts"); 
 parentObsASSERTROOTFocus.setCode("assertions"); 
 parentObsASSERTROOTFocus.setDisplayName("Assertions found in working memory"); 
 parentObsASSERTROOT.setObservationFocus(parentObsASSERTROOTFocus); 
 parentObsASSERTROOT.setClinicalStatementToBeRoot(true); 
 parentObsASSERTROOT.setToBeReturned(true); 
 ObservationValue obsValueASSERTROOT = new ObservationValue(); 
obsValueASSERTROOT.setText(getAssertionsAsString(assertions)); 
parentObsASSERTROOT.setObservationValue(obsValueASSERTROOT); 
 insert(parentObsASSERTROOT); 
 namedObjects.put("parentObsASSERTROOT", (Object)parentObsASSERTROOT);
end


rule "U.01 Response_NumNotMet"
	dialect "java"
	ruleflow-group "numNotMet"
	when
		( EvalTime($evalTime : evalTimeValue) and 
			FocalPersonId($focalPersonId : id) and 
			FocalPersonId($evaluatedPersonId : id) )
	then
		IVLDate obsTimenumerator = new IVLDate(); 
 obsTimenumerator.setLow($evalTime); 
 obsTimenumerator.setHigh($evalTime); 
 ObservationResult childObsnumerator = new ObservationResult(); 
 String childObsnumeratorId = "2.16.840.1.113883.3.795.5.1.1^numerator"; 
 childObsnumerator.setId(childObsnumeratorId); 
 childObsnumerator.setEvaluatedPersonId($evaluatedPersonId); 
 childObsnumerator.setObservationEventTime(obsTimenumerator); 
 childObsnumerator.setSubjectIsFocalPerson($evaluatedPersonId == $focalPersonId); 
 childObsnumerator.setClinicalStatementToBeRoot(false); 
 childObsnumerator.setToBeReturned(true); 
 CD childObsnumeratorFocus = new CD(); 
 childObsnumeratorFocus.setCodeSystem("2.16.840.1.113883.3.795.12.1.1"); 
 childObsnumeratorFocus.setCodeSystemName("OpenCDS concepts"); 
 childObsnumeratorFocus.setCode("C2605"); 
 childObsnumeratorFocus.setDisplayName(getOpenCDSConceptName("C2605")); 
 childObsnumerator.setObservationFocus(childObsnumeratorFocus); 
 int iChildObsnumerator = 0; 
 INT childObsnumeratorIntegerValue = new INT(); 
 childObsnumeratorIntegerValue.setValue(iChildObsnumerator); 
 ObservationValue childObsnumeratorValue = new ObservationValue(); 
 childObsnumeratorValue.setInteger(childObsnumeratorIntegerValue); 
 childObsnumerator.setObservationValue(childObsnumeratorValue); 
 ClinicalStatementRelationship relnumerator = new ClinicalStatementRelationship(); 
 relnumerator.setSourceId("2.16.840.1.113883.3.795.5.1.1^ROOT"); 
 relnumerator.setTargetId("2.16.840.1.113883.3.795.5.1.1^numerator"); 
 CD relnumeratorCode = new CD(); 
 relnumeratorCode.setCodeSystem("2.16.840.1.113883.3.795.12.1.1"); 
 relnumeratorCode.setCodeSystemName("OpenCDS concepts"); 
 relnumeratorCode.setCode("C405"); 
 relnumeratorCode.setDisplayName("Part of"); 
 relnumerator.setTargetRelationshipToSource(relnumeratorCode); 
 java.util.List<RelationshipToSource> childObsnumeratorRelationshipToSources = 
	 new java.util.ArrayList<RelationshipToSource>(); 
 RelationshipToSource childObsnumeratorRelationshipToSource = new RelationshipToSource(); 
 childObsnumeratorRelationshipToSource.setSourceId("2.16.840.1.113883.3.795.5.1.1^ROOT"); 
 childObsnumeratorRelationshipToSource.setRelationshipToSource(relnumeratorCode); 
 childObsnumeratorRelationshipToSources.add(childObsnumeratorRelationshipToSource); 
 childObsnumerator.setRelationshipToSources(childObsnumeratorRelationshipToSources); 
 insert(childObsnumerator); 
 namedObjects.put("childObsnumerator", childObsnumerator); 
 insert(relnumerator); 
 namedObjects.put("relnumerator", relnumerator); 
 IVLDate obsTimedenominator = new IVLDate(); 
 obsTimedenominator.setLow($evalTime); 
 obsTimedenominator.setHigh($evalTime); 
 ObservationResult childObsdenominator = new ObservationResult(); 
 String childObsdenominatorId = "2.16.840.1.113883.3.795.5.1.1^denominator"; 
 childObsdenominator.setId(childObsdenominatorId); 
 childObsdenominator.setEvaluatedPersonId($evaluatedPersonId); 
 childObsdenominator.setObservationEventTime(obsTimedenominator); 
 childObsdenominator.setSubjectIsFocalPerson($evaluatedPersonId == $focalPersonId); 
 childObsdenominator.setClinicalStatementToBeRoot(false); 
 childObsdenominator.setToBeReturned(true); 
 CD childObsdenominatorFocus = new CD(); 
 childObsdenominatorFocus.setCodeSystem("2.16.840.1.113883.3.795.12.1.1"); 
 childObsdenominatorFocus.setCodeSystemName("OpenCDS concepts"); 
 childObsdenominatorFocus.setCode("C2605"); 
 childObsdenominatorFocus.setDisplayName(getOpenCDSConceptName("C2605")); 
 childObsdenominator.setObservationFocus(childObsdenominatorFocus); 
 int iChildObsdenominator = 1; 
 INT childObsdenominatorIntegerValue = new INT(); 
 childObsdenominatorIntegerValue.setValue(iChildObsdenominator); 
 ObservationValue childObsdenominatorValue = new ObservationValue(); 
 childObsdenominatorValue.setInteger(childObsdenominatorIntegerValue); 
 childObsdenominator.setObservationValue(childObsdenominatorValue); 
 ClinicalStatementRelationship reldenominator = new ClinicalStatementRelationship(); 
 reldenominator.setSourceId("2.16.840.1.113883.3.795.5.1.1^ROOT"); 
 reldenominator.setTargetId("2.16.840.1.113883.3.795.5.1.1^denominator"); 
 CD reldenominatorCode = new CD(); 
 reldenominatorCode.setCodeSystem("2.16.840.1.113883.3.795.12.1.1"); 
 reldenominatorCode.setCodeSystemName("OpenCDS concepts"); 
 reldenominatorCode.setCode("C405"); 
 reldenominatorCode.setDisplayName("Part of"); 
 reldenominator.setTargetRelationshipToSource(reldenominatorCode); 
 java.util.List<RelationshipToSource> childObsdenominatorRelationshipToSources = 
	 new java.util.ArrayList<RelationshipToSource>(); 
 RelationshipToSource childObsdenominatorRelationshipToSource = new RelationshipToSource(); 
 childObsdenominatorRelationshipToSource.setSourceId("2.16.840.1.113883.3.795.5.1.1^ROOT"); 
 childObsdenominatorRelationshipToSource.setRelationshipToSource(reldenominatorCode); 
 childObsdenominatorRelationshipToSources.add(childObsdenominatorRelationshipToSource); 
 childObsdenominator.setRelationshipToSources(childObsdenominatorRelationshipToSources); 
 insert(childObsdenominator); 
 namedObjects.put("childObsdenominator", childObsdenominator); 
 insert(reldenominator); 
 namedObjects.put("reldenominator", reldenominator); 
//DslUsed==Out.Nested.Obs.Num.Denom.Dsl|||DENOMVALUE==1|||DENOMID==denominator|||NUMVALUE==0|||NUMID==numerator|||ROOT==ROOT|||OBSFOCUS==C2605
			assertions.add("numNotMet"); 
insert(new Assertion("numNotMet")); 
//DslUsed==Assert.String.Dsl|||ASSERTIONSTRING==numNotMet
			IVLDate obsTimeASSERTROOT = new IVLDate(); 
 obsTimeASSERTROOT.setLow($evalTime); 
 obsTimeASSERTROOT.setHigh($evalTime); 
 ObservationResult parentObsASSERTROOT = new ObservationResult(); 
 String parentObsASSERTROOTId = "2.16.840.1.113883.3.795.5.1.1^ASSERTROOT"; 
 parentObsASSERTROOT.setId(parentObsASSERTROOTId); 
 parentObsASSERTROOT.setEvaluatedPersonId($evaluatedPersonId); 
 parentObsASSERTROOT.setObservationEventTime(obsTimeASSERTROOT); 
 parentObsASSERTROOT.setSubjectIsFocalPerson($evaluatedPersonId == $focalPersonId); 
 CD parentObsASSERTROOTFocus = new CD(); 
 parentObsASSERTROOTFocus.setCodeSystem("2.16.840.1.113883.3.795.12.1.1"); 
 parentObsASSERTROOTFocus.setCodeSystemName("OpenCDS concepts"); 
 parentObsASSERTROOTFocus.setCode("assertions"); 
 parentObsASSERTROOTFocus.setDisplayName("Assertions found in working memory"); 
 parentObsASSERTROOT.setObservationFocus(parentObsASSERTROOTFocus); 
 parentObsASSERTROOT.setClinicalStatementToBeRoot(true); 
 parentObsASSERTROOT.setToBeReturned(true); 
 ObservationValue obsValueASSERTROOT = new ObservationValue(); 
obsValueASSERTROOT.setText(getAssertionsAsString(assertions)); 
parentObsASSERTROOT.setObservationValue(obsValueASSERTROOT); 
 insert(parentObsASSERTROOT); 
 namedObjects.put("parentObsASSERTROOT", (Object)parentObsASSERTROOT);
end


rule "W.01 Response_NumDenomMet"
	dialect "java"
	ruleflow-group "numMet"
	when
		( EvalTime($evalTime : evalTimeValue) and 
			FocalPersonId($focalPersonId : id) and 
			FocalPersonId($evaluatedPersonId : id) )
	then
		IVLDate obsTimenumerator = new IVLDate(); 
 obsTimenumerator.setLow($evalTime); 
 obsTimenumerator.setHigh($evalTime); 
 ObservationResult childObsnumerator = new ObservationResult(); 
 String childObsnumeratorId = "2.16.840.1.113883.3.795.5.1.1^numerator"; 
 childObsnumerator.setId(childObsnumeratorId); 
 childObsnumerator.setEvaluatedPersonId($evaluatedPersonId); 
 childObsnumerator.setObservationEventTime(obsTimenumerator); 
 childObsnumerator.setSubjectIsFocalPerson($evaluatedPersonId == $focalPersonId); 
 childObsnumerator.setClinicalStatementToBeRoot(false); 
 childObsnumerator.setToBeReturned(true); 
 CD childObsnumeratorFocus = new CD(); 
 childObsnumeratorFocus.setCodeSystem("2.16.840.1.113883.3.795.12.1.1"); 
 childObsnumeratorFocus.setCodeSystemName("OpenCDS concepts"); 
 childObsnumeratorFocus.setCode("C2605"); 
 childObsnumeratorFocus.setDisplayName(getOpenCDSConceptName("C2605")); 
 childObsnumerator.setObservationFocus(childObsnumeratorFocus); 
 int iChildObsnumerator = 1; 
 INT childObsnumeratorIntegerValue = new INT(); 
 childObsnumeratorIntegerValue.setValue(iChildObsnumerator); 
 ObservationValue childObsnumeratorValue = new ObservationValue(); 
 childObsnumeratorValue.setInteger(childObsnumeratorIntegerValue); 
 childObsnumerator.setObservationValue(childObsnumeratorValue); 
 ClinicalStatementRelationship relnumerator = new ClinicalStatementRelationship(); 
 relnumerator.setSourceId("2.16.840.1.113883.3.795.5.1.1^ROOT"); 
 relnumerator.setTargetId("2.16.840.1.113883.3.795.5.1.1^numerator"); 
 CD relnumeratorCode = new CD(); 
 relnumeratorCode.setCodeSystem("2.16.840.1.113883.3.795.12.1.1"); 
 relnumeratorCode.setCodeSystemName("OpenCDS concepts"); 
 relnumeratorCode.setCode("C405"); 
 relnumeratorCode.setDisplayName("Part of"); 
 relnumerator.setTargetRelationshipToSource(relnumeratorCode); 
 java.util.List<RelationshipToSource> childObsnumeratorRelationshipToSources 
	 = new java.util.ArrayList<RelationshipToSource>(); 
 RelationshipToSource childObsnumeratorRelationshipToSource = new RelationshipToSource(); 
 childObsnumeratorRelationshipToSource.setSourceId("2.16.840.1.113883.3.795.5.1.1^ROOT"); 
 childObsnumeratorRelationshipToSource.setRelationshipToSource(relnumeratorCode); 
 childObsnumeratorRelationshipToSources.add(childObsnumeratorRelationshipToSource); 
 childObsnumerator.setRelationshipToSources(childObsnumeratorRelationshipToSources); 
 insert(childObsnumerator); 
 namedObjects.put("childObsnumerator", childObsnumerator); 
 insert(relnumerator); 
 namedObjects.put("relnumerator", relnumerator); 
 IVLDate obsTimedenominator = new IVLDate(); 
 obsTimedenominator.setLow($evalTime); 
 obsTimedenominator.setHigh($evalTime); 
 ObservationResult childObsdenominator = new ObservationResult(); 
 String childObsdenominatorId = "2.16.840.1.113883.3.795.5.1.1^denominator"; 
 childObsdenominator.setId(childObsdenominatorId); 
 childObsdenominator.setEvaluatedPersonId($evaluatedPersonId); 
 childObsdenominator.setObservationEventTime(obsTimedenominator); 
 childObsdenominator.setSubjectIsFocalPerson($evaluatedPersonId == $focalPersonId); 
 childObsdenominator.setClinicalStatementToBeRoot(false); 
 childObsdenominator.setToBeReturned(true); 
 CD childObsdenominatorFocus = new CD(); 
 childObsdenominatorFocus.setCodeSystem("2.16.840.1.113883.3.795.12.1.1"); 
 childObsdenominatorFocus.setCodeSystemName("OpenCDS concepts"); 
 childObsdenominatorFocus.setCode("C2605"); 
 childObsdenominatorFocus.setDisplayName(getOpenCDSConceptName("C2605")); 
 childObsdenominator.setObservationFocus(childObsdenominatorFocus); 
 int iChildObsdenominator = 1; 
 INT childObsdenominatorIntegerValue = new INT(); 
 childObsdenominatorIntegerValue.setValue(iChildObsdenominator); 
 ObservationValue childObsdenominatorValue = new ObservationValue(); 
 childObsdenominatorValue.setInteger(childObsdenominatorIntegerValue); 
 childObsdenominator.setObservationValue(childObsdenominatorValue); 
 ClinicalStatementRelationship reldenominator = new ClinicalStatementRelationship(); 
 reldenominator.setSourceId("2.16.840.1.113883.3.795.5.1.1^ROOT"); 
 reldenominator.setTargetId("2.16.840.1.113883.3.795.5.1.1^denominator"); 
 CD reldenominatorCode = new CD(); 
 reldenominatorCode.setCodeSystem("2.16.840.1.113883.3.795.12.1.1"); 
 reldenominatorCode.setCodeSystemName("OpenCDS concepts"); 
 reldenominatorCode.setCode("C405"); 
 reldenominatorCode.setDisplayName("Part of"); 
 reldenominator.setTargetRelationshipToSource(reldenominatorCode); 
 java.util.List<RelationshipToSource> childObsdenominatorRelationshipToSources 
	 = new java.util.ArrayList<RelationshipToSource>(); 
 RelationshipToSource childObsdenominatorRelationshipToSource = new RelationshipToSource(); 
 childObsdenominatorRelationshipToSource.setSourceId("2.16.840.1.113883.3.795.5.1.1^ROOT"); 
 childObsdenominatorRelationshipToSource.setRelationshipToSource(reldenominatorCode); 
 childObsdenominatorRelationshipToSources.add(childObsdenominatorRelationshipToSource); 
 childObsdenominator.setRelationshipToSources(childObsdenominatorRelationshipToSources); 
 insert(childObsdenominator); 
 namedObjects.put("childObsdenominator", childObsdenominator); 
 insert(reldenominator); 
 namedObjects.put("reldenominator", reldenominator); 
//DslUsed==Out.Nested.Obs.Num.Denom.Dsl|||DENOMVALUE==1|||DENOMID==denominator|||NUMVALUE==1|||NUMID==numerator|||ROOT==ROOT|||OBSFOCUS==C2605
			assertions.add("numMet"); 
insert(new Assertion("numMet")); 
//DslUsed==Assert.String.Dsl|||ASSERTIONSTRING==numMet
			IVLDate obsTimeASSERTROOT = new IVLDate(); 
 obsTimeASSERTROOT.setLow($evalTime); 
 obsTimeASSERTROOT.setHigh($evalTime); 
 ObservationResult parentObsASSERTROOT = new ObservationResult(); 
 String parentObsASSERTROOTId = "2.16.840.1.113883.3.795.5.1.1^ASSERTROOT"; 
 parentObsASSERTROOT.setId(parentObsASSERTROOTId); 
 parentObsASSERTROOT.setEvaluatedPersonId($evaluatedPersonId); 
 parentObsASSERTROOT.setObservationEventTime(obsTimeASSERTROOT); 
 parentObsASSERTROOT.setSubjectIsFocalPerson($evaluatedPersonId == $focalPersonId); 
 CD parentObsASSERTROOTFocus = new CD(); 
 parentObsASSERTROOTFocus.setCodeSystem("2.16.840.1.113883.3.795.12.1.1"); 
 parentObsASSERTROOTFocus.setCodeSystemName("OpenCDS concepts"); 
 parentObsASSERTROOTFocus.setCode("assertions"); 
 parentObsASSERTROOTFocus.setDisplayName("Assertions found in working memory"); 
 parentObsASSERTROOT.setObservationFocus(parentObsASSERTROOTFocus); 
 parentObsASSERTROOT.setClinicalStatementToBeRoot(true); 
 parentObsASSERTROOT.setToBeReturned(true); 
 ObservationValue obsValueASSERTROOT = new ObservationValue(); 
obsValueASSERTROOT.setText(getAssertionsAsString(assertions)); 
parentObsASSERTROOT.setObservationValue(obsValueASSERTROOT); 
 insert(parentObsASSERTROOT); 
 namedObjects.put("parentObsASSERTROOT", (Object)parentObsASSERTROOT);
end