188. EPMO Open Source Coordination Office Redaction File Detail Report

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

188.1 Files compared

# Location File Last Modified
1 IV-eHMP_CIF.zip\IMAG_Source\VISA\Java\FederationDataSourceProvider\main\src\java\gov\va\med\imaging\federation\translator FederationDatasourceTranslator.java Mon Dec 4 21:35:10 2017 UTC
2 IV-eHMP_CIF.zip\IMAG_Source\VISA\Java\FederationDataSourceProvider\main\src\java\gov\va\med\imaging\federation\translator FederationDatasourceTranslator.java Mon Dec 4 22:00:29 2017 UTC

188.2 Comparison summary

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

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

188.4 Active regular expressions

No regular expressions were active.

188.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: Mar  4, 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.fed eration.tr anslator;
  27  
  28   import gov .va.med.Pa tientIdent ifier;
  29   import gov .va.med.im aging.exce ptions.URN FormatExce ption;
  30   import gov .va.med.im aging.exch ange.Image AccessLogE vent;
  31   import gov .va.med.im aging.exch ange.Image AccessLogE vent.Image AccessLogE ventType;
  32   import gov .va.med.im aging.exch ange.busin ess.Image;
  33   import gov .va.med.im aging.exch ange.busin ess.Patien t;
  34   import gov .va.med.im aging.exch ange.busin ess.Series ;
  35   import gov .va.med.im aging.exch ange.busin ess.Study;
  36   import gov .va.med.im aging.exch ange.busin ess.StudyF ilter;
  37   import gov .va.med.im aging.exch ange.busin ess.Patien t.PatientS ex;
  38   import gov .va.med.im aging.exch ange.enums .ObjectOri gin;
  39   import gov .va.med.im aging.exch ange.enums .StudyDele tedImageSt ate;
  40   import gov .va.med.im aging.exch ange.enums .StudyLoad Level;
  41   import gov .va.med.im aging.fede ration.web services.t ypes.Feder ationFilte rTypeOrigi n;
  42   import gov .va.med.im aging.fede ration.web services.t ypes.Feder ationImage AccessLogE ventType;
  43   import gov .va.med.im aging.fede ration.web services.t ypes.Feder ationImage AccessLogE ventTypeEv entType;
  44   import gov .va.med.im aging.fede ration.web services.t ypes.Objec tOriginTyp e;
  45  
  46   import jav a.text.Par seExceptio n;
  47   import jav a.text.Sim pleDateFor mat;
  48   import jav a.util.Dat e;
  49   import jav a.util.Ite rator;
  50   import jav a.util.Loc ale;
  51   import jav a.util.Sor tedSet;
  52   import jav a.util.Tre eSet;
  53  
  54   import org .apache.lo gging.log4 j.LogManag er;
  55   import org .apache.lo gging.log4 j.Logger;
  56  
  57   /**
  58    * @author         
WERFEJ
  59    *
  60    */
  61   public cla ss Federat ionDatasou rceTransla tor 
  62   extends Ab stractFede rationData sourceTran slator
  63   {
  64           pr ivate fina l static L ogger logg er = LogMa nager.getL ogger(Fede rationData sourceTran slator.cla ss);
  65           
  66           pu blic Feder ationDatas ourceTrans lator()
  67           {
  68                    supe r();
  69           }
  70           
  71           pu blic Sorte dSet<Study > transfor mStudies(g ov.va.med. imaging.fe deration.w ebservices .types.Fed erationStu dyType []  studies,
  72                             StudyF ilter stud yFilter)
  73           {
  74                    Sort edSet<Stud y> result  = new Tree Set<Study> (); 
  75                    if(s tudies ==  null)
  76                             return  result;
  77                    for( int i = 0;  i < studi es.length;  i++)
  78                    {
  79                             gov.va .med.imagi ng.federat ion.webser vices.type s.Federati onStudyTyp e studyTyp e = studie s[i];
  80                             boolea n useStudy  = true;
  81                             // JMW  6/1/2010  - need to  translate  first to g et the pro per URN to  determine  if allowe d to inclu de in resu lt
  82                             Study  study = tr ansformStu dy(studyTy pe);
  83                             if(stu dyFilter.i sStudyIenS pecified() )
  84                             {
  85                                      if(!stud yFilter.is AllowableS tudyId(stu dy.getGlob alArtifact Identifier ()))
  86                                      {
  87                                               useStudy =  false;
  88                                      }
  89                             }
  90                             if(use Study)
  91                             {
  92                                      result.a dd(study);
  93                             }
  94                    }                 
  95                    // J MW 1/5/200 9 - if the  study IEN  is not sp ecified th en the res ults need  to be filt ered.
  96                    // c all the pr e and post  filter si nce the pr e filter c annot run  on the Fed eration Da tasource b efore call ing the DS
  97                    // b oth need t o be run d epending o n the crea tor - migh t have dif ferent fun ctionality  on the fi lter funct ions
  98                    if(! studyFilte r.isStudyI enSpecifie d())
  99                    {
  100                             studyF ilter.preF ilter(resu lt);
  101                             studyF ilter.post Filter(res ult);
  102                    }
  103                    retu rn result;
  104           }
  105           
  106           pu blic Study  transform Study(gov. va.med.ima ging.feder ation.webs ervices.ty pes.Federa tionStudyT ype studyT ype)
  107           {
  108                    Stud y study =  null;
  109                    Stri ng studyId  = studyTy pe.getStud yId();
  110                    Obje ctOrigin s tudyOrigin  = transfo rmObjectOr igin(study Type.getOb jectOrigin ());
  111                    try
  112                    {
  113                             study  = Study.cr eate(study Origin, st udyType.ge tSiteNumbe r(), study Id, 
  114                                               PatientIde ntifier.ic nPatientId entifier(s tudyType.g etPatientI cn()), 
  115                                               StudyLoadL evel.FULL,  StudyDele tedImageSt ate.cannot IncludeDel etedImages );
  116                    }
  117                    catc h (URNForm atExceptio n x)
  118                    {
  119                             getLog ger().erro r("Unable  to create  a Study fr om the giv en key ele ments", x) ;
  120                    }
  121                    stud y.setDescr iption(stu dyType.get Descriptio n() == nul l ? "" : s tudyType.g etDescript ion());
  122                    stud y.setStudy Uid(studyT ype.getDic omUid());
  123                    stud y.setImage Count(stud yType.getI mageCount( ));
  124                    if ( studyType. getPatient Name() ==  null)
  125                    {
  126                             studyT ype.setPat ientName(" ");
  127                    }
  128                    stud y.setPatie ntName(stu dyType.get PatientNam e().replac eAll("\\^" , " "));
  129                    
  130                    stud y.setProce dureDate(c onvertDICO MDateToDat e(studyTyp e.getProce dureDate() ));
  131                    stud y.setProce dure(study Type.getPr ocedureDes cription()  == null ?  "" : stud yType.getP rocedureDe scription( ));
  132                    stud y.setRadio logyReport ((studyTyp e.getRadio logyReport () == null  ? "" : st udyType.ge tRadiology Report())) ;
  133                    
  134                    stud y.setSiteN ame(studyT ype.getSit eName() ==  null ? ""  : studyTy pe.getSite Name());
  135                    stud y.setSpeci alty(study Type.getSp ecialtyDes cription()  == null ?  "" : stud yType.getS pecialtyDe scription( ));
  136  
  137                    stud y.setOrigi n(studyTyp e.getOrigi n());
  138                    stud y.setSiteA bbr(studyT ype.getSit eAbbreviat ion());
  139                    if(s tudyType.g etStudyMod alities()  != null)
  140                    {                         
  141                             String [] modalit ies = stud yType.getS tudyModali ties().get Modality() ;
  142                             if(mod alities !=  null)
  143                             {
  144                                      for(int  i = 0; i <  modalitie s.length;  i++)
  145                                      {
  146                                               study.addM odality(mo dalities[i ]);
  147                                      }
  148                             }
  149                    }
  150                    
  151                    // D isplay spe cific fiel ds
  152                    stud y.setNoteT itle(study Type.getNo teTitle()) ;
  153                    stud y.setImage Package(st udyType.ge tImagePack age());
  154                    stud y.setImage Type(study Type.getIm ageType()) ;
  155                    stud y.setEvent (studyType .getEvent( ));
  156                    stud y.setOrigi n(studyTyp e.getOrigi n());
  157                    stud y.setImage Package(st udyType.ge tImagePack age());
  158                    stud y.setStudy Class(stud yType.getS tudyClass( ));
  159                    stud y.setCaptu reDate(stu dyType.get CaptureDat e());
  160                    stud y.setCaptu reBy(study Type.getCa pturedBy() );
  161                    stud y.setRpcRe sponseMsg( studyType. getRpcResp onseMsg()) ;
  162                    stud y.setError Message(st udyType.ge tErrorMess age() == n ull ? "" :  studyType .getErrorM essage());
  163                    Imag e firstIma ge = null;
  164                    
  165                    if(s tudyType.g etComponen tSeries()  != null)
  166                    {
  167                             gov.va .med.imagi ng.federat ion.webser vices.type s.Federati onStudyTyp eComponent Series ser ieses = st udyType.ge tComponent Series();
  168                             gov.va .med.imagi ng.federat ion.webser vices.type s.Federati onSeriesTy pe []serie s = series es.getSeri es();
  169                             for(in t i = 0; i  < series. length; i+ +)
  170                             {                                  
  171                                      Series s er = trans formSeries (series[i] );
  172                                      study.ad dSeries(se r);
  173                                      if(first Image == n ull)
  174                                      {
  175                                               Iterator<I mage> iter  = ser.ite rator();
  176                                               if(iter.ha sNext())
  177                                                       fi rstImage =  iter.next ();
  178                                      }
  179                             }
  180                    }
  181                    
  182                    if(f irstImage  != null)
  183                    {
  184                             study. setFirstIm age(firstI mage);
  185                             study. setFirstIm ageIen(fir stImage.ge tIen());
  186                    }
  187                    
  188                    retu rn study;
  189           }
  190           
  191           pr ivate Seri es transfo rmSeries(g ov.va.med. imaging.fe deration.w ebservices .types.Fed erationSer iesType se riesType)
  192           {
  193                    if(s eriesType  == null)
  194                             return  null;
  195                    Seri es series  = new Seri es();
  196                    seri es.setSeri esIen(seri esType.get SeriesId() );
  197                    seri es.setSeri esNumber(s eriesType. getDicomSe riesNumber () + "");
  198                    seri es.setSeri esUid(seri esType.get DicomUid()  == null ?  "" : seri esType.get DicomUid() );
  199                    seri es.setObje ctOrigin(t ransformOb jectOrigin (seriesTyp e.getObjec tOrigin()) );
  200                    seri es.setModa lity(serie sType.getS eriesModal ity());
  201                    
  202                    gov. va.med.ima ging.feder ation.webs ervices.ty pes.Federa tionInstan ceType []  instances  = seriesTy pe.getComp onentInsta nces().get Instance() ;
  203                    if(i nstances ! = null) {
  204                             for(in t i = 0; i  < instanc es.length;  i++) {
  205                                      Image im age = tran sformImage (instances [i]);//, s eries, stu dyType);
  206                                      series.a ddImage(im age);
  207                             }
  208                    }                 
  209                    retu rn series;
  210           }
  211           
  212           pr ivate Imag e transfor mImage(gov .va.med.im aging.fede ration.web services.t ypes.Feder ationInsta nceType in stanceType )
  213           {
  214                    if(i nstanceTyp e == null)
  215                             return  null;
  216                    
  217                    Imag e image =  null;
  218                    try
  219                    {
  220                             image  = Image.cr eate(
  221                                      instance Type.getSi teNumber()
  222                                      instance Type.getIm ageId(), 
  223                                      instance Type.getGr oupId() ==  null ? in stanceType .getStudyI d() : inst anceType.g etGroupId( ), 
  224                                      PatientI dentifier. icnPatient Identifier (instanceT ype.getPat ientIcn())
  225                                      instance Type.getIm ageModalit y() 
  226                             );
  227                    }
  228                    catc h (URNForm atExceptio n x)
  229                    {
  230                             logger .error("Un able to cr eate an Im age instan ce from th e given ke y elements .");
  231                             return  null;
  232                    }
  233                    
  234                    imag e.setImage Number(ins tanceType. getImageNu mber() ==  null ? ""  : instance Type.getIm ageNumber( ) + "");
  235                    //im age.setIen (instanceT ype.getIma geId());
  236                    imag e.setImage Uid(instan ceType.get DicomUid()  == null ?  "" : inst anceType.g etDicomUid ());
  237                    imag e.setDescr iption(ins tanceType. getDescrip tion() ==  null ? ""  : instance Type.getDe scription( ));
  238                    
  239                    imag e.setPatie ntName(ins tanceType. getPatient Name() ==  null ? ""  : instance Type.getPa tientName( ).replaceA ll("\\^",  " "));
  240                    imag e.setProce dureDate(c onvertDICO MDateToDat e(instance Type.getPr ocedureDat e()));
  241                    imag e.setProce dure(insta nceType.ge tProcedure () == null  ? "" : in stanceType .getProced ure());
  242                    imag e.setSiteA bbr(instan ceType.get SiteAbbr() );
  243                    imag e.setObjec tOrigin(tr ansformObj ectOrigin( instanceTy pe.getObje ctOrigin() ));
  244                    //im age.setSit eNumber(in stanceType .getSiteNu mber());
  245                    imag e.setFullL ocation(in stanceType .getFullLo cation());
  246                    imag e.setFullF ilename(in stanceType .getFullIm ageFilenam e());
  247                    imag e.setAbsLo cation(ins tanceType. getAbsLoca tion());
  248                    imag e.setAbsFi lename(ins tanceType. getAbsImag eFilename( ));
  249                    imag e.setDicom ImageNumbe rForDispla y(instance Type.getDi comImageNu mberForDis play() ==  null ? ""  : instance Type.getDi comImageNu mberForDis play() + " ");
  250                    imag e.setDicom SequenceNu mberForDis play(insta nceType.ge tDicomSequ enceNumber ForDisplay () == null  ? "" : in stanceType .getDicomS equenceNum berForDisp lay() + "" );
  251                    imag e.setImgTy pe(instanc eType.getI mageType() .intValue( ));
  252                    imag e.setImage Class(inst anceType.g etImageCla ss());
  253                    imag e.setBigFi lename(ins tanceType. getBigImag eFilename( ));
  254                    imag e.setQaMes sage(insta nceType.ge tQaMessage ());
  255                    imag e.setError Message(in stanceType .getErrorM essage() = = null ? " " : instan ceType.get ErrorMessa ge());
  256                    retu rn image;
  257           }
  258           
  259           pu blic Objec tOrigin tr ansformObj ectOrigin(
  260                             gov.va .med.imagi ng.federat ion.webser vices.type s.ObjectOr iginType o bjectOrigi nType)
  261           {
  262                    if(O bjectOrigi nType._DOD .equals(ob jectOrigin Type.getVa lue()))
  263                    {
  264                             return  ObjectOri gin.DOD;
  265                    }
  266                    retu rn ObjectO rigin.VA;
  267           }
  268  
  269           pu blic Feder ationFilte rTypeOrigi n transfor mOrigin(St ring filte rOrigin)
  270           {
  271                    if(" VA".equals IgnoreCase (filterOri gin))
  272                    {
  273                             return  Federatio nFilterTyp eOrigin.va lue2;
  274                    }
  275                    else  if("DOD". equalsIgno reCase(fil terOrigin) )
  276                    {
  277                             return  Federatio nFilterTyp eOrigin.va lue4;
  278                    }
  279                    else  if("NON-V A".equalsI gnoreCase( filterOrig in))
  280                    {
  281                             return  Federatio nFilterTyp eOrigin.va lue3;
  282                    }
  283                    else  if("FEE". equalsIgno reCase(fil terOrigin) )
  284                    {
  285                             return  Federatio nFilterTyp eOrigin.va lue5;
  286                    }
  287                    else
  288                    {
  289                             return  Federatio nFilterTyp eOrigin.va lue1;
  290                    }
  291           }
  292           
  293           pu blic Feder ationImage AccessLogE ventType t ransformLo gEvent(Ima geAccessLo gEvent log Event)
  294           {
  295                    Fede rationImag eAccessLog EventType  result = n ew Federat ionImageAc cessLogEve ntType();
  296                    resu lt.setImag eId(logEve nt.getImag eIen());
  297                    resu lt.setPati entIcn(log Event.getP atientIcn( ));
  298                    resu lt.setReas on(logEven t.getReaso nCode());
  299                    resu lt.setSite Number(log Event.getS iteNumber( ));
  300                    resu lt.setEven tType(tran sformLogEv entType(lo gEvent.get EventType( )));
  301                    resu lt.setUser SiteNumber (logEvent. getUserSit eNumber()) ;
  302                    retu rn result;
  303           }
  304           
  305           pu blic Feder ationImage AccessLogE ventTypeEv entType tr ansformLog EventType( ImageAcces sLogEventT ype eventT ype)
  306           {
  307                    if(e ventType = = ImageAcc essLogEven tType.IMAG E_COPY)
  308                    {
  309                             return  Federatio nImageAcce ssLogEvent TypeEventT ype.IMAGE_ COPY;
  310                    }
  311                    else  if(eventT ype == Ima geAccessLo gEventType .IMAGE_PRI NT)
  312                    {
  313                             return  Federatio nImageAcce ssLogEvent TypeEventT ype.IMAGE_ PRINT;
  314                    }
  315                    else  if(eventT ype == Ima geAccessLo gEventType .PATIENT_I D_MISMATCH )
  316                    {
  317                             return  Federatio nImageAcce ssLogEvent TypeEventT ype.PATIEN T_ID_MISMA TCH;
  318                    }
  319                    retu rn Federat ionImageAc cessLogEve ntTypeEven tType.IMAG E_ACCESS;                   
  320           }
  321           
  322           pu blic Sorte dSet<Patie nt> transf ormPatient s(gov.va.m ed.imaging .federatio n.webservi ces.types. PatientTyp e [] patie nts)
  323           {
  324                    if(p atients ==  null)
  325                             return  null;
  326                    Sort edSet<Pati ent> resul t = new Tr eeSet<Pati ent>();              
  327                    for( int i = 0;  i < patie nts.length ; i++)
  328                    {
  329                             try
  330                             {
  331                                      Patient  patient =  transformP atient(pat ients[i]);
  332                                      if(patie nt != null )
  333                                      {
  334                                               result.add (patient);     
  335                                      }
  336                             }
  337                             catch( ParseExcep tion pX)
  338                             {
  339                                      logger.e rror("Pars e Exceptio n converti ng patient ", pX);
  340                             }
  341                    }                 
  342                    retu rn result;
  343           }
  344           
  345           pu blic Patie nt transfo rmPatient( gov.va.med .imaging.f ederation. webservice s.types.Pa tientType  patientTyp e)
  346           th rows Parse Exception
  347           {
  348                    Pati ent patien t = null;
  349                    if(p atientType  == null)
  350                             return  patient;
  351                    pati ent = new  Patient(pa tientType. getPatient Name(), pa tientType. getPatient Icn(),
  352                                      patientT ype.getVet eranStatus (), 
  353                                      transfor mPatientSe x(patientT ype.getPat ientSex())
  354                                      transfor mPatientDO B(patientT ype.getPat ientDob()) ,
  355                                      null, nu ll, null);
  356                    retu rn patient ;
  357           }
  358           
  359           pr ivate Pati entSex tra nsformPati entSex(gov .va.med.im aging.fede ration.web services.t ypes.Feder ationPatie ntSexType  patientSex Type)
  360           {
  361                    if(g ov.va.med. imaging.fe deration.w ebservices .types.Fed erationPat ientSexTyp e._FEMALE. equals(pat ientSexTyp e)){
  362                             return  PatientSe x.Female;
  363                    }
  364                    else  if(gov.va .med.imagi ng.federat ion.webser vices.type s.Federati onPatientS exType._MA LE.equals( patientSex Type))
  365                    {
  366                             return  PatientSe x.Male;
  367                    }
  368                    retu rn Patient Sex.Unknow n;
  369           }
  370           
  371           pr ivate Date  transform PatientDOB (String pa tientTypeD ob)
  372           th rows Parse Exception
  373           {
  374                    Simp leDateForm at sdf = n ew SimpleD ateFormat( "MM/dd/yy" , Locale.U S);
  375                    retu rn sdf.par se(patient TypeDob);
  376           }
  377   }