39. EPMO Open Source Coordination Office Redaction File Detail Report

Produced by Araxis Merge on 10/2/2017 7:00:17 AM Central Daylight Time. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.

39.1 Files compared

# Location File Last Modified
1 cds.zip\cds\product\production\opencds\cds-rules-test\src\main\resources\rules com.cognitive^hypertension^1.0.0.drl Fri Jul 1 17:45:46 2016 UTC
2 cds.zip\cds\product\production\opencds\cds-rules-test\src\main\resources\rules com.cognitive^hypertension^1.0.0.drl Wed Sep 27 16:03:33 2017 UTC

39.2 Comparison summary

Description Between
Files 1 and 2
Text Blocks Lines
Unchanged 3 490
Changed 2 28
Inserted 0 0
Removed 0 0

39.3 Comparison options

Whitespace
Character case Differences in character case are significant
Line endings Differences in line endings (CR and LF characters) are ignored
CR/LF characters Not shown in the comparison detail

39.4 Active regular expressions

No regular expressions were active.

39.5 Comparison detail

  1   package hy pertension ;
  2  
  3   import org .joda.time .Period;
  4   import org .joda.time .PeriodTyp e;
  5   import jav a.util.Dat e;
  6   import jav a.text.Dec imalFormat ;
  7  
  8   import ca. uhn.fhir.m odel.api.I Datatype;
  9   import ca. uhn.fhir.m odel.dstu2 .composite .CodeableC onceptDt;
  10   import ca. uhn.fhir.m odel.dstu2 .composite .CodingDt;
  11   import ca. uhn.fhir.m odel.dstu2 .composite .QuantityD t;
  12   import ca. uhn.fhir.m odel.dstu2 .composite .Contained Dt;
  13   import ca. uhn.fhir.m odel.dstu2 .resource. Communicat ionRequest ;
  14   import ca. uhn.fhir.m odel.dstu2 .resource. Provenance ;
  15   import ca. uhn.fhir.m odel.dstu2 .resource. Provenance .Agent;
  16   import ca. uhn.fhir.m odel.dstu2 .resource. Communicat ionRequest .Payload;
  17   import ca. uhn.fhir.m odel.dstu2 .resource. Observatio n;
  18   import ca. uhn.fhir.m odel.dstu2 .resource. Observatio n.Related;
  19   import ca. uhn.fhir.m odel.dstu2 .resource. Procedure;
  20   import ca. uhn.fhir.m odel.dstu2 .resource. Patient;
  21   import ca. uhn.fhir.m odel.primi tive.Strin gDt;
  22   import jav a.util.Arr ayList;
  23   import jav a.util.Ite rator;
  24   import jav a.util.Lis t;
  25   import jav a.util.Col lections;
  26   import org .opencds.s ervice.eva luate.Obse rvationCom parator;
  27  
  28   global jav a.lang.Str ing client Language
  29   global jav a.lang.Str ing client TimeZoneOf fset
  30   global jav a.lang.Str ing focalP ersonId
  31   global jav a.util.Dat e evalTime
  32   global jav a.util.Has hSet asser tions
  33   global jav a.util.Has hMap named Objects
  34    
  35   import fun ction org. opencds.se rvice.eval uate.FhirU tils.isCod ingContain s;
  36   import fun ction org. opencds.se rvice.eval uate.FhirU tils.getVa lueQuantit y;
  37   import fun ction org. opencds.se rvice.eval uate.FhirU tils.creat eProvenanc e;
  38   import fun ction org. opencds.se rvice.eval uate.FhirU tils.creat eCommunica tionReques t;
  39   import fun ction org. opencds.se rvice.eval uate.FhirU tils.hasIn putFlag;
  40   import fun ction org. opencds.se rvice.eval uate.FhirU tils.creat eOutputExt ension;
  41  
  42   // An Obje ct to hold  all the o bservation s that wou ld trigger  the final  rules
  43   declare HY PERTENSION _COHORT
  44       @prope rtyReactiv e
  45           di astolic        : bool ean @key
  46           sy stolic : b oolean @ke y
  47           me dHf :boole an @key
  48           ed ucation :  boolean @k ey
  49           sy stolicMR :  Observati on // Most  recent Sy stolic Obs ervation
  50           di astolicMR  : Observat ion // Mos t recent D iastolic O bservation
  51           he ightList :  ArrayList
  52           we ightList :  ArrayList
  53           he ightMR : O bservation  // Most r ecent heig ht Observa tion
  54           we ightMR : O bservation  // Most r ecent weig ht Observa tion
  55           bp List : Arr ayList //  systolic/d iastolic b lood press ure observ ation list
  56   end
  57  
  58   rule "Init ialize"
  59           sa lience 200 , no-loop
  60           wh en
  61           th en
  62                    inse rt(new HYP ERTENSION_ COHORT(fal se, false,  false, fa lse, null,  null,new  ArrayList( ), new Arr ayList(),  null, null , new Arra yList()));                    
  63   end
  64  
  65   rule "Coll ect Blood  Pressure O bservation s"
  66           di alect "jav a"
  67           sa lience 190
  68      when
  69        $coho rt : HYPER TENSION_CO HORT()
  70        $obs  : Observat ion( isCod ingContain s(code, "h ttp://loin c.org", "5 5284-4"))
  71      then
  72      modify( $cohort) {  getBpList ().add($ob s) };
  73      
  74   end   
  75    
  76  
  77   rule "The  most recen t combined  systolic/ diastolic  Blood Pres sure Obser vation"
  78           di alect "jav a"
  79           sa lience 20
  80       when
  81                 $cohort  : HYPERTE NSION_COHO RT(!bpList .isEmpty() )
  82           th en
  83       Collec tions.sort ($cohort.g etBpList() , Observat ionCompara tor.ISSUED _DATE );
  84       Observ ation o =  (Observati on)$cohort .getBpList ().get(0);
  85       List<R elated> re latedObs =  o.getRela ted();
  86       for (I terator it erator = r elatedObs. iterator() ; iterator .hasNext() ;) {
  87           Re lated rela ted = (Rel ated) iter ator.next( );
  88           Ob servation  obs = (Obs ervation)r elated.get Target().g etResource ();
  89           if (obs != nu ll) {
  90                    if(o bs.getId() .getValue( ).equalsIg noreCase(" #systolic" )){
  91                         modify($co hort) { se tSystolicM R( obs ) } ;
  92                         System.out .println(o bs);
  93                    }
  94                     if( obs.getId( ).getValue ().equalsI gnoreCase( "#diastoli c")){
  95                         modify($co hort) { se tDiastolic MR( obs )  };
  96                         System.out .println(o bs);
  97                    }
  98           }
  99       }
  100   end  
  101  
  102   rule "High  Systolic  blood pres sure"
  103         dial ect "java" , no-loop
  104         sali ence 10
  105         when
  106         $coh ort : HYPE RTENSION_C OHORT(syst olicMR !=  null, $sys tolicMR :  systolicMR )
  107        
  108         eval (getValueQ uantity($s ystolicMR. getValue() ).getValue ().intValu e() < 160  )
  109         eval (getValueQ uantity($s ystolicMR. getValue() ).getValue ().intValu e() > 139  )
  110         
  111         then
  112         modi fy($cohort ) { setSys tolic( tru e ) };
  113        
  114         Syst em.out.pri ntln("Syst olic = " +  getValueQ uantity($s ystolicMR. getValue() ).getValue ());
  115   end 
  116  
  117  
  118   rule "High  Diastolic  blood pre ssure"
  119         dial ect "java"
  120         sali ence 10
  121         when
  122            $ cohort : H YPERTENSIO N_COHORT(d iastolicMR  != null,  $diastolic MR : diast olicMR)
  123        
  124         eval (getValueQ uantity($d iastolicMR .getValue( )).getValu e().intVal ue() > 89  )
  125         eval (getValueQ uantity($d iastolicMR .getValue( )).getValu e().intVal ue() < 100  )
  126         
  127         then
  128         modi fy($cohort ) { setDia stolic( tr ue ) };
  129        
  130         Syst em.out.pri ntln("Dias tolic = "  + getValue Quantity($ diastolicM R.getValue ()).getVal ue());
  131   end 
  132  
  133   rule "Coll ect Height  Observati ons"
  134           di alect "jav a"
  135           sa lience 160
  136           wh en
  137                $cohort  : HYPERTEN SION_COHOR T()
  138           $o bs : Obser vation( is CodingCont ains(code,  "http://l oinc.org",  "8302-2") )
  139           th en
  140           mo dify($coho rt) { getH eightList(  ).add($ob s) };                                    
  141   end
  142  
  143   rule "Coll ect Weight  Observati ons"
  144           di alect "jav a"
  145           sa lience 150
  146           wh en
  147                $cohort  : HYPERTEN SION_COHOR T()
  148           $o bs : Obser vation( is CodingCont ains(code,  "http://l oinc.org",  "29463-7" ))
  149          
  150           th en
  151           mo dify($coho rt) { getW eightList(  ).add($ob s) };                                    
  152   end
  153  
  154   rule "The  most recen t weight O bservation "
  155           di alect "jav a"
  156           sa lience 20
  157       when
  158                 $cohort  : HYPERTE NSION_COHO RT(!weight List.isEmp ty())
  159                 
  160           th en
  161    
  162       Collec tions.sort ($cohort.g etWeightLi st(), Obse rvationCom parator.IS SUED_DATE  );
  163       Observ ation o =  (Observati on)$cohort .getWeight List().get (0);
  164       modify ($cohort)  { setWeigh tMR( o ) } ;
  165   end  
  166  
  167   rule "The  most recen t Height O bservation "
  168           di alect "jav a"
  169           sa lience 20
  170       when
  171                 $cohort  : HYPERTE NSION_COHO RT(!height List.isEmp ty())
  172           th en
  173       Collec tions.sort ($cohort.g etHeightLi st(), Obse rvationCom parator.IS SUED_DATE  );
  174       Observ ation o =  (Observati on)$cohort .getHeight List().get (0);
  175       modify ($cohort)  { setHeigh tMR( o ) } ;
  176      
  177   end    
  178  
  179   rule "Had  HTN EDUCAT IONAL INTE RVENTIONS"
  180         dial ect "java"
  181         sali ence 60
  182         when
  183          $co hort : HYP ERTENSION_ COHORT()
  184          $pr ocedure :  Procedure( $type: typ e)
  185                eval(isCod ingContain s($type, " http://ehm p. DNS     /terminolo gy/1.0", " /concept/V A-HTN%20EX ERCISE%20E DUCATION")  || 
  186                          isCodingCo ntains($ty pe, "http: //ehmp. DNS     /terminolo gy/1.0", " /concept/V A-HTN%20NU TRITION%20 EDUCATION" ) ||
  187                          isCodingCo ntains($ty pe, "http: //ehmp. DNS     /terminolo gy/1.0", " /concept/V A-HTN%20NU TRITION%20 EDUCATION" )
  188               )
  189        
  190         then
  191         modi fy($cohort ) { setEdu cation( tr ue ) };
  192         Syst em.out.pri ntln(" edu cation rul e fired "  );
  193   end
  194  
  195   rule "Had  HTN MED &  OTHER INTE RVENTIONS"
  196         dial ect "java"
  197         sali ence 50
  198         when
  199          $co hort : HYP ERTENSION_ COHORT()
  200          $ob s : Observ ation($cod e: code, 
  201                                        isCodingCo ntains($co de, "http: //ehmp. DNS     /terminolo gy/1.0", " /concept/H TN%20MEDIC ATIONS%20A DJUSTED")  || 
  202                                           isCodingCo ntains($co de, "http: //ehmp. DNS     /terminolo gy/1.0", " /concept/H TN%20REFUS AL%20OF%20 MED%20INTE RVENTION")  ||
  203                                           isCodingCo ntains($co de, "http: //ehmp. DNS     /terminolo gy/1.0", " /concept/H TN%20EVALU ATION%20OF %20RESISTA NT/SECONDA RY") ||
  204                                           isCodingCo ntains($co de, "http: //ehmp. DNS     /terminolo gy/1.0", " /concept/H TN%20NO%20 MED%20CHAN GE%20-%20B P%20CONTRO LLED") ||
  205                                           isCodingCo ntains($co de, "http: //ehmp. DNS     /terminolo gy/1.0", " /concept/H TN%20NO%20 MED%20CHAN GE%20-%20C OMORBID%20 ILLNESS")  ||
  206                                           isCodingCo ntains($co de, "http: //ehmp. DNS     /terminolo gy/1.0", " /concept/H TN%20NO%20 MED%20CHAN GE%20-%20S IDE%20EFFE CTS%20FROM %20RX") ||
  207                                           isCodingCo ntains($co de, "http: //ehmp. DNS     /terminolo gy/1.0", " /concept/H TN%20NO%20 MED%20CHAN GE%20-%20L IMITED%20L IFE%20EXP" ) ||
  208                                           isCodingCo ntains($co de, "http: //ehmp. DNS     /terminolo gy/1.0", " /concept/H TN%20NO%20 MED%20CHAN GE%20-%20N ONCOMPLIAN CE") ||
  209                                           isCodingCo ntains($co de, "http: //ehmp. DNS     /terminolo gy/1.0", " /concept/H TN%20NO%20 MED%20CHAN GE%20-%20O THER") ||
  210                                           isCodingCo ntains($co de, "http: //ehmp. DNS     /terminolo gy/1.0", " /concept/H TN%20LIFES TYLE%20MOD IFICATIONS %20RECOMME NDED") ||
  211                                           isCodingCo ntains($co de, "http: //ehmp. DNS     /terminolo gy/1.0", " /concept/H TN%20NO%20 EDUC%20INT ERVENTION% 20WARRANTE D") 
  212                                )
  213             
  214         then
  215         modi fy($cohort ) { setMed Hf( true )  };
  216         Syst em.out.pri ntln("Had  HTN MED &  OTHER INTE RVENTIONS  " );
  217   end
  218  
  219   rule "Hype rtension S creening"
  220         dial ect "java"
  221         sali ence 0
  222         when
  223          $co hort : HYP ERTENSION_ COHORT( di astolic ==  true, sys tolic == t rue, medHf  == false,  education  == false,  $systolic MR : systo licMR, $di astolicMR  : diastoli cMR, 
  224                              heigh tMR != nul l, $height MR:heightM R, weightM R != null,  $weightMR :weightMR)
  225         
  226         then
  227         // F ormula: we ight (lb)  / [height  (in)]2 x 7 03
  228              // Calcula te BMI by  dividing w eight in p ounds (lbs ) by heigh t in inche s (in) squ ared and m ultiplying  by a conv ersion fac tor of 703 .
  229         doub le bmi = ( getValueQu antity($we ightMR.get Value()).g etValue(). doubleValu e() / 
  230                                (ge tValueQuan tity($heig htMR.getVa lue()).get Value().do ubleValue( ) * 
  231                                get ValueQuant ity($heigh tMR.getVal ue()).getV alue().dou bleValue() )) * 703;
  232         Deci malFormat  formatter  = new Deci malFormat( "#.00");
  233         Comm unicationR equest com Request =  createComm unicationR equest("Th e most rec ent record ed BP was  elevated.  Satisfying  this remi nder requi res addres sing medic ation issu es and/or  education  issues. Th e patient' s last rec orded BP i s " + 
  234         getV alueQuanti ty($systol icMR.getVa lue()).get Value() +  "/" + getV alueQuanti ty($diasto licMR.getV alue()).ge tValue() +  " mmHg an d their BM I is " +
  235         form atter.form at(bmi) +  " kg/m^2."  );
  236         
  237         
  238         Code ableConcep tDt catego ry = new C odeableCon ceptDt("SN OMED", "41 9772000");
  239         comR equest.set Category(c ategory);
  240         cate gory.getCo dingFirstR ep().setDi splay("Fam ily Medici ne");
  241         cate gory.setTe xt("Family  Medicine" );
  242         
  243         Code ableConcep tDt reason  = new Cod eableConce ptDt("SNOM ED", "4197 72000");
  244         comR equest.get Reason().a dd(reason) ;
  245         reas on.getCodi ngFirstRep ().setDisp lay("Hyper tension Sc reening NC R.");
  246         
  247         Code ableConcep tDt priori ty = new C odeableCon ceptDt("CD S-System",  "50");
  248         prio rity.getCo dingFirstR ep().setDi splay("Rou tine");
  249         comR equest.set Priority(p riority);
  250         
  251         Prov enance pro v = create Provenance ("http://w ww.uspreve ntiveservi cestaskfor ce.org/");
  252         Cont ainedDt co ntained =  new Contai nedDt();
  253              contained. getContain edResource s().add(pr ov);
  254         comR equest.set Contained( contained) ;
  255         comR equest.add Undeclared Extension( createOutp utExtensio n());
  256         prov .addUndecl aredExtens ion(create OutputExte nsion());
  257         name dObjects.p ut("commun icationReq uest", com Request); 
  258         name dObjects.p ut("proven ance", pro v);
  259   end