401. EPMO Open Source Coordination Office Redaction File Detail Report

Produced by Araxis Merge on 12/5/2017 12:06:50 PM Central Standard 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.

401.1 Files compared

# Location File Last Modified
1 IV-eHMP_CIF.zip\IMAG_Source\VISA\Java\VistaImagingDataSourceProvider\main\src\java\gov\va\med\imaging\vistaimagingdatasource VistaImagingStudyGraphDataSourceServiceV0.java Mon Dec 4 21:34:50 2017 UTC
2 IV-eHMP_CIF.zip\IMAG_Source\VISA\Java\VistaImagingDataSourceProvider\main\src\java\gov\va\med\imaging\vistaimagingdatasource VistaImagingStudyGraphDataSourceServiceV0.java Mon Dec 4 22:06:54 2017 UTC

401.2 Comparison summary

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

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

401.4 Active regular expressions

No regular expressions were active.

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