51. EPMO Open Source Coordination Office Redaction File Detail Report

Produced by Araxis Merge on 10/2/2017 7:00:31 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.

51.1 Files compared

# Location File Last Modified
1 cds.zip\cds\product\production\opencds\opencds-knowledge-repository-data\src\main\resources\resources_v1.3\knowledgePackages com.cognitive^hypertension^1.0.0.drl Wed Jul 12 18:43:52 2017 UTC
2 cds.zip\cds\product\production\opencds\opencds-knowledge-repository-data\src\main\resources\resources_v1.3\knowledgePackages com.cognitive^hypertension^1.0.0.drl Wed Sep 27 16:16:26 2017 UTC

51.2 Comparison summary

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

51.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

51.4 Active regular expressions

No regular expressions were active.

51.5 Comparison detail

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