159. EPMO Open Source Coordination Office Redaction File Detail Report

Produced by Araxis Merge on 7/10/2017 1:01:47 PM 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.

159.1 Files compared

# Location File Last Modified
1 C:\AraxisMergeCompare\Pri_un\IV-ehmp_cif\VistaImagingDataSourceProvider\main\src\java\gov\va\med\imaging\vistaimagingdatasource VistaImagingStudyGraphDataSourceServiceV0.java Thu Jun 29 17:22:03 2017 UTC
2 C:\AraxisMergeCompare\Pri_re\IV-ehmp_cif\VistaImagingDataSourceProvider\main\src\java\gov\va\med\imaging\vistaimagingdatasource VistaImagingStudyGraphDataSourceServiceV0.java Thu Jul 6 15:06:06 2017 UTC

159.2 Comparison summary

Description Between
Files 1 and 2
Text Blocks Lines
Unchanged 3 700
Changed 2 4
Inserted 0 0
Removed 0 0

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

159.4 Active regular expressions

No regular expressions were active.

159.5 Comparison detail

  1   /**
  2    * 
  3     Package:  MAG - Vis tA Imaging
  4     WARNING:  Per VHA D irective 2 004-038, t his routin e should n ot be modi fied.
  5     Date Cre ated: Feb  22, 2008
  6     Site Nam e:  Washin gton OI Fi eld Office , Silver S pring, MD
  7       Developer:          
WERFEJ
  8     Descript ion: 
  9  
  10           ;;  +-------- ---------- ---------- ---------- ---------- ---------- ---------- +
  11           ;;  Property  of the US  Government .
  12           ;;  No permis sion to co py or redi stribute t his softwa re is give n.
  13           ;;  Use of un released v ersions of  this soft ware requi res the us er
  14           ;;   to execu te a writt en test ag reement wi th the Vis tA Imaging
  15           ;;   Developm ent Office  of the De partment o f Veterans  Affairs,
  16           ;;   telephon e (301) 73 4-0100.
  17           ;;
  18           ;;  The Food  and Drug A dministrat ion classi fies this  software a s
  19           ;;  a Class I I medical  device.  A s such, it  may not b e changed
  20           ;;  in any wa y.  Modifi cations to  this soft ware may r esult in a n
  21           ;;  adulterat ed medical  device un der 21CFR8 20, the us e of which
  22           ;;  is consid ered to be  a violati on of US F ederal Sta tutes.
  23           ;;  +-------- ---------- ---------- ---------- ---------- ---------- ---------- +
  24  
  25    */
  26   package go v.va.med.i maging.vis taimagingd atasource;
  27  
  28   import gov .va.med.Gl obalArtifa ctIdentifi er;
  29   import gov .va.med.Pa tientIdent ifier;
  30   import gov .va.med.Ro utingToken ;
  31   import gov .va.med.im aging.arti factsource .ResolvedA rtifactSou rce;
  32   import gov .va.med.im aging.core .interface s.exceptio ns.Connect ionExcepti on;
  33   import gov .va.med.im aging.core .interface s.exceptio ns.MethodE xception;
  34   import gov .va.med.im aging.data source.Stu dyGraphDat aSourceSpi ;
  35   import gov .va.med.im aging.data source.exc eptions.In validCrede ntialsExce ption;
  36   import gov .va.med.im aging.exce ptions.URN FormatExce ption;
  37   import gov .va.med.im aging.exch ange.busin ess.Image;
  38   import gov .va.med.im aging.exch ange.busin ess.Site;
  39   import gov .va.med.im aging.exch ange.busin ess.Study;
  40   import gov .va.med.im aging.exch ange.busin ess.StudyF ilter;
  41   import gov .va.med.im aging.exch ange.busin ess.StudyS etResult;
  42   import gov .va.med.im aging.exch ange.enums .ObjectOri gin;
  43   import gov .va.med.im aging.exch ange.enums .StudyDele tedImageSt ate;
  44   import gov .va.med.im aging.exch ange.enums .StudyLoad Level;
  45   import gov .va.med.im aging.prot ocol.vista .VistaImag ingTransla tor;
  46   import gov .va.med.im aging.core .interface s.exceptio ns.Patient NotFoundEx ception;
  47   import gov .va.med.im aging.tran sactioncon text.Trans actionCont extFactory ;
  48   import gov .va.med.im aging.url. vista.Vist aQuery;
  49   import gov .va.med.im aging.url. vista.exce ptions.Inv alidVistaC redentials Exception;
  50   import gov .va.med.im aging.url. vista.exce ptions.Vis taMethodEx ception;
  51   import gov .va.med.im aging.vist adatasourc e.common.V istaCommon Utilities;
  52   import gov .va.med.im aging.vist adatasourc e.session. VistaSessi on;
  53   import gov .va.med.im aging.vist aimagingda tasource.c ommon.Vist aImagingCo mmonUtilit ies;
  54   import gov .va.med.im aging.vist aobjects.V istaGroup;
  55   import gov .va.med.im aging.vist aobjects.V istaImage;
  56  
  57   import jav a.io.IOExc eption;
  58   import jav a.util.Ite rator;
  59   import jav a.util.Sor tedSet;
  60   import jav a.util.Tre eSet;
  61  
  62   import org .apache.lo g4j.Logger ;
  63  
  64   /**
  65    * @author         
WERFEJ
  66    *
  67    */
  68   public cla ss VistaIm agingStudy GraphDataS ourceServi ceV0 
  69   extends Ab stractBase VistaImagi ngStudyGra phService
  70   implements  StudyGrap hDataSourc eSpi
  71   {
  72           /*  ========= ========== ========== ========== ========== ========== ==========
  73            *  Instance  fields and  methods
  74            *  ========= ========== ========== ========== ========== ========== ==========  */
  75           pr ivate Logg er logger  = Logger.g etLogger(t his.getCla ss());
  76           
  77           //  The requi red versio n of VistA  Imaging n eeded to e xecute the  RPC calls  for this  operation
  78           pu blic final  static St ring MAG_R EQUIRED_VE RSION = "3 .0P46";
  79           
  80           pu blic final  static St ring SUPPO RTED_PROTO COL = "vis taimaging" ;
  81       
  82       /**
  83            *  @param re solvedArti factSource
  84            *  @param pr otocol
  85            * /
  86           pu blic Vista ImagingStu dyGraphDat aSourceSer viceV0(Res olvedArtif actSource  resolvedAr tifactSour ce, String  protocol)
  87           {
  88                    supe r(resolved ArtifactSo urce, prot ocol);
  89           }
  90  
  91           /*  (non-Java doc)
  92            *  @see gov. va.med.ima ging.vista datasource .AbstractB aseVistaSt udyGraphSe rvice#getR equiredVis taImagingV ersion()
  93            * /
  94           @O verride
  95           pr otected St ring getRe quiredVist aImagingVe rsion() 
  96           {
  97                    retu rn VistaIm agingCommo nUtilities .getVistaD ataSourceI magingVers ion(
  98                                      VistaIma gingDataSo urceProvid er.getVist aConfigura tion(), th is.getClas s(), 
  99                                      MAG_REQU IRED_VERSI ON);
  100           }
  101  
  102           /*  (non-Java doc)
  103            *  @see gov. va.med.ima ging.datas ource.Stud yGraphData SourceSpi# getPatient Studies(ja va.lang.St ring, gov. va.med.ima ging.excha nge.busine ss.StudyFi lter)
  104            * /
  105           @O verride
  106           pu blic Study SetResult  getPatient Studies(Ro utingToken  globalRou tingToken,  
  107                    Pati entIdentif ier patien tIdentifie r,
  108                    Stud yFilter fi lter, 
  109                    Stud yLoadLevel  studyLoad Level) 
  110           th rows Unsup portedOper ationExcep tion, Meth odExceptio n, Connect ionExcepti on
  111           {
  112                    Vist aCommonUti lities.set DataSource MethodAndV ersion("ge tPatientSt udies", ge tDataSourc eVersion() );
  113                    logg er.info("g etPatientS tudies(" +  patientId entifier +  
  114                                      ", " + ( filter ==  null ? "<n ull>" : fi lter.toStr ing()) + 
  115                                      ", Study  load leve l " + stud yLoadLevel .toString( ) + 
  116                                      ") Trans actionCont ext (" + T ransaction ContextFac tory.get() .getDispla yIdentity( ) + ").");
  117                    
  118                    Vist aSession l ocalVistaS ession = n ull;
  119  
  120                    try
  121                    {
  122                             localV istaSessio n = getVis taSession( );
  123                             
  124                             String  patientDf n = null;
  125                             try
  126                             {
  127                                      patientD fn = getPa tientDfn(l ocalVistaS ession, pa tientIdent ifier);
  128                             }
  129                             catch( PatientNot FoundExcep tion pnfX)
  130                             {
  131                                      // JMW 3 /12/08 The  patient w as not fou nd in the  database,  return an  empty set  of studies  instead o f
  132                             logger .warn("Pat ient [" +  patientIde ntifier +  "] was not  found in  the VistA  database,  returning  empty stud y set", pn fX);
  133                             return  StudySetR esult.crea teFullResu lt(new Tre eSet<Study >());
  134                             }
  135                             
  136                             // If  we are get ting many  studies (i .e. not a  single stu dy IEN spe cified)
  137                             // the n check th e patient  sensitivit y level
  138                             // If  a single I EN is spec ified then  it is ass umed that  the patien t sensitiv ity
  139                             // has  already b een checke d.
  140                             if((fi lter == nu ll) || (!f ilter.isSt udyIenSpec ified()))
  141                             {
  142                                      // we ar e getting  the full s tudy graph
  143                                      checkPat ientSensit ive(localV istaSessio n, patient Dfn, patie ntIdentifi er, filter );
  144                             }                         
  145                             
  146                             Sorted Set<Study>  groups =  null;
  147                             logger .info("Get ting group s for pati ent '" + p atientIden tifier + " '.");
  148                    try
  149                    {
  150                             groups  = getPati entGroups( localVista Session, g etSite(), 
  151                                               patientIde ntifier, p atientDfn,  filter, s tudyLoadLe vel);
  152                    } 
  153                    catc h (IOExcep tion e)
  154                    {
  155                             logger .error(e.g etMessage( ));
  156                    } 
  157                    logg er.info("F ound '" +  groups.siz e() + "' g roups for  patient '"  + patient Identifier  + "'");
  158                             // no  groups is  not an exc eption sce nario but  it does me an we don' t need to  bother get ting more 
  159                             // inf ormation a bout each  study
  160                             if(gro ups.size()  == 0)
  161                                      return S tudySetRes ult.create FullResult (groups);
  162                             
  163                             if(fil ter != nul l && filte r.isStudyI enSpecifie d()) 
  164                             {
  165                                      GlobalAr tifactIden tifier stu dyUrn = fi lter.getSt udyId();
  166                                      
  167                                      for(Iter ator<Study > groupIte r = groups .iterator( ); groupIt er.hasNext (); )
  168                                      {
  169                                               Study grou p = groupI ter.next() ;
  170                                               if(! filte r.isAllowa bleStudyId (group.get GlobalArti factIdenti fier()))
  171                                               //if(! fil ter.isAllo wableStudy Id(studyUr n.toString ()))
  172                                                       gr oupIter.re move();
  173                                      }
  174                                      if(group s.size() = = 0)
  175                                               throw new  MethodExce ption("Stu dy [" + (s tudyUrn ==  null ? "n ull" : stu dyUrn.toSt ring()) +  "] not fou nd");
  176                             }
  177                             else 
  178                             {                                  
  179                                      // JMW 1 2/17/2008,  call the  filter to  remove stu dies from  the groups , this way
  180                                      // the d atasource  doesn't ne ed to have  knowledge  of the fi lter detai ls
  181                                      if(filte r != null)
  182                                      {
  183                                               filter.pre Filter(gro ups);
  184                                      }
  185                             }
  186                             // if  we filtere d everythi ng out ret urn now, a nd don't b other maki ngthe call
  187                             // to  populate t he entire  Studies tr ee
  188                             if(gro ups.size()  == 0)
  189                                      return S tudySetRes ult.create FullResult (groups);
  190           
  191                             if(!st udyLoadLev el.isInclu deImages() )
  192                             {
  193                                      // don't  want the  images, ju st study l evel data
  194                                      if(filte r != null)
  195                                      {
  196                                               filter.pos tFilter(gr oups);
  197                                      }
  198                                      
  199                                      if(study LoadLevel. isIncludeR eport())
  200                                      {
  201                                               logger.inf o("Loading  reports f or filtere d groups") ;
  202                                               for(Study  study : gr oups)
  203                                               {
  204                                                       Vi staImaging CommonUtil ities.setS tudyRadiol ogyReport( localVista Session, s tudy);
  205                                               }
  206                                               logger.inf o("Complet ed getPati entStudies (), return ing '" + g roups.size () + "' st udies.");
  207                                               return Stu dySetResul t.createFu llResult(g roups);
  208                                      }
  209                                      else
  210                                      {
  211                                               logger.inf o("Complet ed getPati entStudies (), no rep ort or ima ges. Retur ning '" +  groups.siz e() + "' s tudies.");
  212                                               return Stu dySetResul t.createFu llResult(g roups);
  213                                      }
  214                             }                         
  215                             logger .info("Loa ding study  graph dat a for filt ered group s");
  216                             
  217                             // div erge from  study grap h way of d oing thing s                  
  218                             try 
  219                             {
  220                                      for(Stud y study :  groups)
  221                                      {
  222                                               // if the  study is a  group stu dy
  223                                               if(study.g etFirstIma ge() == nu ll)
  224                                               {
  225                                                       //  CTB 29Nov 2009
  226                                                       // String gro upStudyId  = Base32Co nversionUt ility.base 32Decode(s tudy.getSt udyIen());
  227                                                       St ring group StudyId =  study.getS tudyIen();
  228                                                       Vi staQuery g roupImages Query = Vi staImaging QueryFacto ry.createG etStudyIma gesVistaQu ery(groupS tudyId);
  229                                                       
  230                                                       //  get the g roup of im ages from  VistA
  231                                                       St ring vista Response =  localVist aSession.c all(groupI magesQuery );
  232                                                       //  convert t hem into I mage busin ess object s
  233                                                       So rtedSet<Vi staImage>  vistaImage s = VistaI magingTran slator.cre ateImageGr oupFromIma geLines(vi staRespons e, study);
  234                                                       
  235                                                       //  create th e series f or the ima ges and ad d them to  the study
  236                                                       Vi staImaging CommonUtil ities.addV istaImages ToStudyAsS eries(stud y, vistaIm ages);
  237                                                       
  238                                                       So rtedSet<Im age> image s = VistaI magingTran slator.tra nsform(stu dy.getSite Number(), 
  239                                                                         study. getStudyIe n(), patie ntIdentifi er, vistaI mages);
  240                                                       
  241                                                       if (study.get FirstImage () == null  && images .size() >  0)
  242                                               {
  243                                                       Im age firstI mage = ima ges.first( );
  244                                                       st udy.setFir stImage(fi rstImage);
  245                                                       st udy.setFir stImageIen (firstImag e.getIen() );
  246                                                       st udy.setPat ientName(f irstImage. getPatient Name());
  247                                               }
  248                                               }
  249                                               else
  250                                               {
  251                                                       So rtedSet<Im age>images  = new Tre eSet<Image >();                                              
  252                                                       im ages.add(s tudy.getFi rstImage() );
  253                                                       
  254                                                       //  create th e series f or the ima ges and ad d them to  the study
  255                                                       Vi staImaging CommonUtil ities.addI magesToStu dyAsSeries (study, im ages);
  256                                               }
  257                                              
  258                                               // get the  report fo r the stud y
  259                                               if(studyLo adLevel.is IncludeRep ort())
  260                                               {
  261                                                       Vi staImaging CommonUtil ities.setS tudyRadiol ogyReport( localVista Session, s tudy);
  262                                               }
  263                                      }
  264                                      logger.i nfo("Compl eted getPa tientStudi es(), retu rning '" +  groups.si ze() + "'  studies.") ;
  265                                      return S tudySetRes ult.create FullResult (groups);
  266                             }
  267                             catch( VistaMetho dException  vmX)
  268                             {
  269                                      logger.e rror("Erro r getting  group imag es for stu dies", vmX );
  270                                      throw ne w MethodEx ception(vm X);
  271                             }
  272                             catch( InvalidVis taCredenti alsExcepti on ivcX)
  273                             {
  274                                      logger.e rror("Erro r getting  group imag es for stu dies", ivc X);
  275                                      throw ne w InvalidC redentials Exception( ivcX);
  276                             }
  277                             catch  (URNFormat Exception  urnfX)
  278                             {
  279                                      logger.e rror("Erro r getting  group imag es for stu dies, unab le to tran sform Vist aImage to  Image", ur nfX);
  280                                      throw ne w MethodEx ception(ur nfX);
  281                             }
  282                    } 
  283                    catc h (IOExcep tion e)
  284           {
  285                             throw  new Connec tionExcept ion(e);
  286           }
  287                    fina lly
  288                    {
  289                             try{lo calVistaSe ssion.clos e();}
  290                             catch( Throwable  t){}
  291                    }
  292           }                 
  293           
  294           /* *
  295            *  @throws I OException  
  296            *  @throws M ethodExcep tion 
  297            *  @throws C onnectionE xception 
  298            *  @throws I nvalidVist aCredentia lsExceptio
  299            *  
  300            * /
  301           pr ivate Sort edSet<Stud y> getPati entGroups( VistaSessi on session , Site sit e, Patient Identifier  patientId entifier,  String pat ientDfn, 
  302                             StudyF ilter filt er, StudyL oadLevel s tudyLoadLe vel)
  303           th rows Metho dException , IOExcept ion, Conne ctionExcep tion
  304           {                 
  305                    logg er.info("g etPatientG roups(" +  patientIde ntifier +  ") Transac tionContex t (" + Tra nsactionCo ntextFacto ry.get().g etDisplayI dentity()  + ").");
  306  
  307                    Vist aQuery vm  = VistaIma gingQueryF actory.cre ateGetGrou psVistaQue ry(patient Dfn, filte r);
  308                    
  309                    Stri ng rtn = n ull;
  310                    try
  311                    {
  312                             logger .info("Mak ing call t o get grou ps for pat ient '" +  patientIde ntifier +  "'");
  313                             rtn =  session.ca ll(vm);
  314                             // che ck to be s ure first  character  is a 1 (me ans result  is ok)
  315                             
  316                             // if  no images  for patien t, respons e is [0^No  images fo r filter:  All Images ]
  317                             
  318                             if(rtn .charAt(0)  == '1') 
  319                             {                         
  320                                      SortedSe t<VistaGro up> groups  = VistaIm agingTrans lator.crea teGroupsFr omGroupLin esHandleSi ngleImageG roup(
  321                                               site, rtn,  patientId entifier,  studyLoadL evel, Stud yDeletedIm ageState.c annotInclu deDeletedI mages);
  322                                      return V istaImagin gTranslato r.transfor m(ObjectOr igin.VA, s ite, group s);
  323                             }
  324                             else i f(rtn.star tsWith("0^ No images  for filter ")) 
  325                             {
  326                                      logger.i nfo("0 res ponse from  MAG4 PAT  GET IMAGES  rpc, no i mages foun d, [" + rt n + "]");
  327                                      return n ew TreeSet <Study>();
  328                             }
  329                             else i f(rtn.star tsWith("0^ No Such Pa tient:")) 
  330                             {
  331                                      logger.i nfo("0 res ponse from  MAG4 PAT  GET IMAGES  rpc, [" +  rtn + "]" );
  332                                      throw ne w VistaMet hodExcepti on("No pat ient [ "+  patientIde ntifier +  "] found i n database ");
  333                             }
  334                             else 
  335                             {
  336                                      logger.i nfo("0 res ponse from  MAG4 PAT  GET IMAGES  rpc, [" +  rtn + "]" );
  337                                      throw ne w VistaMet hodExcepti on(rtn);
  338                             }
  339                    }
  340                    catc h (Excepti on ex)
  341                    {
  342                             logger .error(ex) ;
  343                             throw  new Method Exception( ex);
  344                    }
  345           }
  346           
  347           @O verride
  348           pr otected St ring getDa taSourceVe rsion()
  349           {
  350                    retu rn "0";
  351           }
  352   }