425. EPMO Open Source Coordination Office Redaction File Detail Report

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

425.1 Files compared

# Location File Last Modified
1 IV-eHMP_CIF.zip\IMAG_Source\VISA\Java\VixVistaImagingDataSourceProvider\main\src\java\gov\va\med\imaging\vistaimagingdatasource\vix\translator VistaImagingVixTranslator.java Mon Dec 4 21:35:20 2017 UTC
2 IV-eHMP_CIF.zip\IMAG_Source\VISA\Java\VixVistaImagingDataSourceProvider\main\src\java\gov\va\med\imaging\vistaimagingdatasource\vix\translator VistaImagingVixTranslator.java Mon Dec 4 22:07:40 2017 UTC

425.2 Comparison summary

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

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

425.4 Active regular expressions

No regular expressions were active.

425.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: Jun  29, 2011
  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. vix.transl ator;
  27  
  28   import gov .va.med.im aging.Abst ractImagin gURN;
  29   import gov .va.med.im aging.Imag eAnnotatio nURN;
  30   import gov .va.med.im aging.Imag eURN;
  31   import gov .va.med.im aging.core .interface s.exceptio ns.MethodE xception;
  32   import gov .va.med.im aging.exce ptions.URN FormatExce ption;
  33   import gov .va.med.im aging.exch ange.busin ess.annota tions.Imag eAnnotatio n;
  34   import gov .va.med.im aging.exch ange.busin ess.annota tions.Imag eAnnotatio nDetails;
  35   import gov .va.med.im aging.exch ange.busin ess.annota tions.Imag eAnnotatio nSource;
  36   import gov .va.med.im aging.exch ange.busin ess.annota tions.Imag eAnnotatio nUser;
  37   import gov .va.med.im aging.url. vista.Stri ngUtils;
  38  
  39   import jav a.text.Par seExceptio n;
  40   import jav a.text.Sim pleDateFor mat;
  41   import jav a.util.Arr ayList;
  42   import jav a.util.Dat e;
  43   import jav a.util.Lis t;
  44  
  45   import org .apache.lo gging.log4 j.LogManag er;
  46   import org .apache.lo gging.log4 j.Logger;
  47  
  48   /**
  49    * @author         
WERFEJ
  50    *
  51    */
  52   public cla ss VistaIm agingVixTr anslator
  53   {
  54           
  55           pr ivate fina l static L ogger logg er = 
  56                    LogM anager.get Logger(Vis taImagingV ixTranslat or.class);
  57  
  58           /* *
  59            *  Translate  the raw r esult from  VistA int o ImageAnn otation bu siness obj ects
  60            *  
  61                    1^3^ 242
  62                    1^IM AGPROVIDER ONETWOSIX, ONETWOSIX^ Jul 26, 20 11@07:50:0 4^16.2^CLI NICAL_CAPT URE^0^^CAR DIOLOGY^SA LT LAKE CI TY^126
  63                    2^IM AGPROVIDER ONETWOSIX, ONETWOSIX^ Jul 26, 20 11@07:50:5 9^16.2^CLI NICAL_CAPT URE^0^^CAR DIOLOGY^SA LT LAKE CI TY^126
  64                    3^IM AGPROVIDER ONETWOSIX, ONETWOSIX^ Jul 26, 20 11@07:57:1 0^16.2^CLI NICAL_CAPT URE^0^^CAR DIOLOGY^SA LT LAKE CI TY^126
  65            *  
  66            *  
  67            *  @param vi staResult
  68            *  @return
  69            * /     
  70           pu blic stati c List<Ima geAnnotati on> transl ateImageAn notations( AbstractIm agingURN i magingUrn,  String vi staResult)
  71           th rows Metho dException
  72           {
  73                    List <ImageAnno tation> im ageAnnotat ions = new  ArrayList <ImageAnno tation>();
  74                    Stri ng [] line s = String Utils.Spli t(vistaRes ult, Strin gUtils.NEW _LINE);
  75                    Stri ng statusL ine = line s[0].trim( );
  76                    if(! statusLine .startsWit h("1"))
  77                    {
  78                             logger .error("Er ror retrie ving annot ations for  image ["  + imagingU rn.toStrin g() + "],  " + status Line);
  79                             throw  new Method Exception( "Exception  retrievin g image an notations  for image  '" + imagi ngUrn.toSt ring() + " ', " + sta tusLine);
  80                    }
  81                    Stri ng imageIe n = getIma geIenFromS tatusLine( statusLine , imagingU rn);             
  82                    for( int i = 1;  i < lines .length; i ++)
  83                    {
  84                             imageA nnotations .add(trans lateImageA nnotation( imagingUrn , imageIen , lines[i] .trim()));
  85                    }
  86                    retu rn imageAn notations;                  
  87           }
  88           
  89           /* *
  90            *  Translate  an image  annotation  
  91            *  
  92                    3^IM AGPROVIDER ONETWOSIX, ONETWOSIX^ Jul 26, 20 11@07:57:1 0^16.2^CLI NICAL_CAPT URE^0^^CAR DIOLOGY^SA LT LAKE CI TY^126
  93            *  
  94            *  @param im agingUrn T he identif ier of the  object co ntaining t he annotat ion
  95            *  @param im ageIen The  ien of th e image (s ince the A bstractIma gingURN ma y or may n ot be an i mage)
  96            *  @param im ageAnnotat ionLine
  97            *  @return
  98            * /
  99           pr ivate stat ic ImageAn notation t ranslateIm ageAnnotat ion(Abstra ctImagingU RN imaging Urn,
  100                             String  imageIen,
  101                             String  imageAnno tationLine )
  102           th rows Metho dException
  103           {
  104                    Stri ng [] piec es = Strin gUtils.Spl it(imageAn notationLi ne, String Utils.CARE T);
  105                    Stri ng layerId  = pieces[ 0];
  106                    Stri ng provide rName = pi eces[1];
  107                    Stri ng annotat ionDate =  pieces[2];
  108                    Stri ng version  = pieces[ 3];
  109                    Stri ng source  = pieces[4 ];
  110                    Stri ng deleted  = pieces[ 5];
  111                    Stri ng savedAf terResulte d = pieces [6];
  112                    Stri ng service  = pieces[ 7];
  113                    // p iece 8 is  the site n ame for so me reason
  114                    Stri ng userDuz  = pieces[ 9];
  115                    
  116                    try
  117                    {
  118                             ImageA nnotationU RN annotat ionUrn = 
  119                                      ImageAnn otationURN .create(im agingUrn.g etOriginat ingSiteId( ), layerId
  120                                                       im ageIen,
  121                                                       im agingUrn.g etPatientI d());
  122                             ImageU RN imageUr n = null;
  123                             if(ima gingUrn in stanceof I mageURN)
  124                             {
  125                                      imageUrn  = (ImageU RN)imaging Urn;
  126                             }
  127                             else
  128                             {
  129                                      imageUrn  = ImageUR N.create(i magingUrn. getOrigina tingSiteId (), 
  130                                                       im ageIen, im agingUrn.g etImagingI dentifier( ), imaging Urn.getPat ientId());
  131                             }
  132                             
  133                             Date d ate = tran slateAnnot ationDate( annotation Date);
  134                             ImageA nnotationS ource imag eAnnotatio nSource =  translateA nnotationS ource(sour ce);
  135                             
  136                             ImageA nnotationU ser annota tionUser =  new Image Annotation User(userD uz, provid erName, se rvice);
  137                             
  138                             return  new Image Annotation (imageUrn,  annotatio nUrn, anno tationUser , date, 
  139                                               imageAnnot ationSourc e, ("1".eq uals(saved AfterResul ted) ? tru e : false)
  140                                               version, ( "1".equals (deleted)) );
  141                    }
  142                    catc h(URNForma tException  urnfX)
  143                    {
  144                             throw  new Method Exception( urnfX);
  145                    }
  146                    catc h(ParseExc eption pX)
  147                    {
  148                             throw  new Method Exception( pX);
  149                    }
  150           }
  151           
  152           /* *
  153            *  Translate  the resul t of a sto re annotat ion RPC ca ll
  154            *  
  155            *  
  156                    1^3^ 242
  157                    3^^^ ^^^^^^126
  158            *  
  159            *  
  160            *  @param im agingUrn
  161            *  @param vi staResult
  162            *  @return
  163            *  @throws M ethodExcep tion
  164            * /
  165           pu blic stati c ImageAnn otation tr anslateSto reImageAnn otationRes ult(Abstra ctImagingU RN imaging Urn, Strin g vistaRes ult)
  166           th rows Metho dException
  167           {
  168                    Stri ng [] line s = String Utils.Spli t(vistaRes ult, Strin gUtils.NEW _LINE);
  169                    Stri ng statusL ine = line s[0].trim( );
  170                    if(! statusLine .startsWit h("1"))
  171                    {
  172                             logger .error("Er ror storin g annotati on details  for image  [" + imag ingUrn.toS tring() +  "], " + st atusLine);
  173                             throw  new Method Exception( "Exception  storing i mage annot ation deta ils (" + i magingUrn. toString()  + "), " +  statusLin e);
  174                    }                 
  175                    Stri ng imageIe n = getIma geIenFromS tatusLine( statusLine , imagingU rn);
  176                    retu rn transla teImageAnn otation(im agingUrn,  imageIen,  lines[1].t rim());          
  177           }
  178           
  179           /* *
  180            *  Translate  an image  annotation  source fr om the str ing
  181            *  @param so urce
  182            *  @return
  183            * /
  184           pr ivate stat ic ImageAn notationSo urce trans lateAnnota tionSource (String so urce)
  185           {
  186                    retu rn ImageAn notationSo urce.getFr omEncodedV alue(sourc e);
  187           }
  188           
  189           /* *
  190            *  translate  a date fr om string  to Date ob ject
  191            *  @param an notationDa te
  192            *  @return
  193            *  @throws P arseExcept ion
  194            * /
  195           pu blic stati c Date tra nslateAnno tationDate (String an notationDa te)
  196           th rows Parse Exception
  197           {
  198                    if(a nnotationD ate.length () <= 0)
  199                             return  null;
  200                                                       
  201                    Simp leDateForm at sdf = g etExpected DateFormat (annotatio nDate);//  new Simple DateFormat ("MMM dd,  yyyy@kk:mm :ss");
  202                    retu rn sdf.par se(annotat ionDate);
  203           }
  204           
  205           pr ivate stat ic SimpleD ateFormat  getExpecte dDateForma t(String a nnotationD ate)
  206           {
  207                    // J un 30, 201 1@10:26:58  = 21 char acters
  208                    // J un 30, 201 1@10:26:5  = 20 chara cters
  209                    // J un 30, 201 1@10:26 =  18 charact ers
  210                    Simp leDateForm at sdf = n ull;
  211                    swit ch(annotat ionDate.le ngth())
  212                    {
  213                             case 1 8:
  214                                      sdf = ne w SimpleDa teFormat(" MMM dd, yy yy@kk:mm") ;
  215                                      break;
  216                             case 2 0:
  217                                      sdf = ne w SimpleDa teFormat(" MMM dd, yy yy@kk:mm:s ");
  218                                      break;
  219                             defaul t:
  220                                      sdf = ne w SimpleDa teFormat(" MMM dd, yy yy@kk:mm:s s");
  221                                      break;
  222                    }
  223                    retu rn sdf;
  224           }
  225           
  226           /* *
  227            *  Translate  the detai ls of an i mage annot ation from  raw RPC r esult into  a busines s object
  228            *
  229                    1^4^ 242
  230                    1^IM AGPROVIDER ONETWOSIX, ONETWOSIX^ Jul 26, 20 11@07:50:0 4^16.2^CLI NICAL_CAPT URE^0^^CAR DIOLOGY^SA LT LAKE CI TY^126
  231                    <?xm l version= "1.0"?>
  232                    <His tory image IEN="836"  annotator= "John Publ ic" userDU Z="111" pr imesitenum ber="222"  service="E lectrician " resulted ="0" total marks="1"  version="I G16.2"><Pa ge number= "0" marks= "1">,,, 
  233            *  
  234            *  @param im agingUrn
  235            *  @param im ageAnnotat ionUrn
  236            *  @param vi staResult
  237            *  @return
  238            *  @throws M ethodExcep tion
  239            * /
  240           pu blic stati c ImageAnn otationDet ails trans lateImageA nnotationD etails(Abs tractImagi ngURN imag ingUrn, 
  241                             ImageA nnotationU RN imageAn notationUr n, String  vistaResul t)
  242           th rows Metho dException
  243           {
  244                    Stri ng [] line s = String Utils.Spli t(vistaRes ult, Strin gUtils.NEW _LINE);
  245                    Stri ng statusL ine = line s[0].trim( );
  246                    if(! statusLine .startsWit h("1"))
  247                    {
  248                             logger .error("An notation [ " + imageA nnotationU rn.toStrin g() + "] h as error,  " + status Line);
  249                             throw  new Method Exception( "Exception  retrievin g image an notation d etails ("  + imageAnn otationUrn .toString( ) + "), "  + statusLi ne);
  250                    }
  251                    
  252                    // J MW 9/27/20 11 - The M  code will  return a  status of  1 even if  the annota tion detai ls are not  found
  253                    // c heck for a  0 in the  count to i ndicate th ere are no  lines
  254                    Stri ng lineCou nt = Strin gUtils.Mag Piece(stat usLine, St ringUtils. CARET, 2);
  255                    if(" 0".equals( lineCount) )
  256                    {
  257                             logger .error("An notation [ " + imageA nnotationU rn.toStrin g() + "] h as error,  " + status Line);
  258                             throw  new Method Exception( "No annota tion detai ls for ["  + imageAnn otationUrn .toString( ) + "], "  + statusLi ne);
  259                    }
  260                    
  261                    Stri ng imageIe n = getIma geIenFromS tatusLine( statusLine , imagingU rn);
  262                    Stri ng headerL ine = line s[1].trim( );
  263                    Imag eAnnotatio n imageAnn otation =  translateI mageAnnota tion(imagi ngUrn, ima geIen, hea derLine);
  264                    Stri ngBuilder  xml = new  StringBuil der(); 
  265                    for( int i = 2;  i < lines .length; i ++)
  266                    {
  267                             //xml. append(lin es[i].trim ()); 
  268                             // JMW  9/21/2011  - no long er doing a  trim on t he line, i t was caus ing issues  in the cl ient becau se the XML  would not  be format ted proper ly if an a ttribute e nded on a  new line ( no space b etween att ributes)
  269                             xml.ap pend(lines [i]);
  270                    }
  271                    retu rn new Ima geAnnotati onDetails( imageAnnot ation, xml .toString( ));
  272           }
  273           
  274           pr ivate stat ic String  getImageIe nFromStatu sLine(Stri ng statusL ine, Abstr actImaging URN imagin gUrn)
  275           {
  276                    Stri ng [] stat usLinePiec es = Strin gUtils.Spl it(statusL ine, Strin gUtils.CAR ET);
  277                    Stri ng imageIe n = status LinePieces [2].trim() ;
  278                    if(i mageIen.le ngth() <=  0)
  279                             imageI en = imagi ngUrn.getI magingIden tifier();
  280                    retu rn imageIe n;
  281           }
  282   }