26. EPMO Open Source Coordination Office Redaction File Detail Report

Produced by Araxis Merge on 11/2/2017 7:18:12 AM Central Daylight Time. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.

26.1 Files compared

# Location File Last Modified
1 CAPRI_CIF.zip\CAPRI_CIF\Source VlerDasClaim.pas Wed Nov 1 18:09:28 2017 UTC
2 CAPRI_CIF.zip\CAPRI_CIF\Source VlerDasClaim.pas Wed Nov 1 18:45:22 2017 UTC

26.2 Comparison summary

Description Between
Files 1 and 2
Text Blocks Lines
Unchanged 6 802
Changed 5 16
Inserted 0 0
Removed 0 0

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

26.4 Active regular expressions

No regular expressions were active.

26.5 Comparison detail

  1   unit VlerD asClaim;
  2  
  3   interface
  4  
  5   uses Class es, XMLInt f, XMLDoc,  XsdEngine Lite, XmlC onfig, Xsd ComplexTyp e,
  6        XmlCo mponentBin dings, Ext Ctrls, Sys Utils, IdC oderMIME
  7        , unt ConstVals
  8        ;
  9  
  10   type
  11     TVlerDas Claim = cl ass
  12       //cons t        / / DONE : L MS moved t o a consts  unit
  13         //CL IENT_ASSIG NING_AUTHO RITY_SSA =  '2.16.840 .1.113883. 3.184';
  14         //CL IENT_ASSIG NING_AUTHO RITY_VA =  '2.16.840. 1.113883.4 .349';
  15       privat e
  16         Atta chmentsLis t: TList;  //of TVler DasAttachm ent
  17         Name spacePrefi x: String;
  18         Name spaceURI:  String;
  19         XsdE ngine: TXs dEngineLit e;
  20         XmlC onfig: TXm lConfig;
  21         Root Panel: TPa nel;
  22         proc edure Rend erMedicalD ataXml(Xml Node: IXML Node);
  23         func tion FixDe lphiXmlBug s(xmlDocum ent: IXMLD ocument):  IXMLDocume nt;
  24         func tion Refor matNamespa ceIfNeeded (CurrentNa mespace :  String) :  String;    // CodeCR5 63 JRL 9/2 /14
  25       public
  26         Docu mentCreati onDate: St ring;
  27         Docu mentTypeVe rsion: Str ing;
  28         Clai mID: Strin g;
  29         Docu mentTitleT ext: Strin g;
  30         Docu mentVersio n: String;
  31         Docu mentIdenti ficationID : String;
  32         Clie ntIdentifi cationID:  String;
  33         Clie ntAssignin gAuthority : String;
  34         Serv iceProvide rIdentific ationID: S tring;
  35         Serv iceProvide rAssigning Authority:  String;
  36         Serv iceProvide rRoleTitle : String;
  37         Pati entDateOfB irth: Stri ng;
  38         Pati entFirstNa me: String ;
  39         Pati entMiddleN ame: Strin g;
  40         Pati entLastNam e: String;
  41         Pati entGender:  String;
  42         Pati entSSN: St ring;
  43         Prov iderFirstN ame: Strin g;
  44         Prov iderMiddle Name: Stri ng;
  45         Prov iderLastNa me: String ;
  46         Faci lityIdenti ficationID : String;
  47         Faci lityIdenti ficationTe xt: String ;
  48         Faci lityName:  String;
  49         Appr overID : S tring;                        //  CodeCR563  JRL 6/9/1 4
  50         Appr overAssign ingAuthori ty : Strin g;      //  CodeCR563  JRL 6/9/1 4
  51         Appr overLastNa me : Strin g;                 //  CodeCR563  JRL 6/9/1 4
  52         Appr overFirstN ame : Stri ng;                //  CodeCR563  JRL 6/9/1 4
  53         Appr overMiddle Name : Str ing;               //  CodeCR563  JRL 6/9/1 4
  54         Phys icalSource  : String;                    //  CodeCR563  JRL 6/9/1 4
  55         Exam ID : Strin g;                            //  CodeCR563  JRL 6/9/1 4
  56         Exam inerType :  String;                      //  CodeCR563  JRL 6/9/1 4
  57         Cont ractType :  String;                      //  CodeCR563  JRL 6/9/1 4
  58         Stat usDate : S tring;                        //  CodeCR563  JRL 6/9/1 4
  59         Comm ents : Str ing;                          //  CodeCR563  JRL 6/9/1 4
  60         Stat usText : S tring;                        //  CodeCR563  JRL 6/10/ 14
  61         proc edure SetX mlNamespac e(prefix:  String; UR I: String) ;
  62         proc edure SetA ttachments (listOfAtt achments:  TList); // of TVlerDa sAttachmen t
  63         proc edure SetR ootPanel(t heRootPane l: TPanel) ;
  64         func tion ToXml : IXMLDocu ment;
  65       publis hed
  66         cons tructor Cr eate(theXs dEngine: T XsdEngineL ite; theXm lConfig: T XmlConfig) ;
  67     end;
  68  
  69   type
  70     TVlerDas Attachment  = class
  71       public
  72         // D ecodeFileN M: String;
  73         Bina ryBase64Ob ject: Wide String;
  74         Bina ryDescript ionText: S tring;
  75         Bina ryFormatSt andardName : String;
  76         Bina ryLocation URI: Strin g;
  77         Bina rySizeValu e: String;
  78         Bina ryCategory Text: Stri ng;
  79         clas s function  EncodeToB ase64(stre am: TStrea m): WideSt ring;
  80         clas s function  DecodeToB ase64(Text In: WideSt ring): TSt ream;
  81     end;
  82  
  83   implementa tion
  84  
  85   uses forms ;
  86  
  87   constructo r TVlerDas Claim.Crea te(theXsdE ngine: TXs dEngineLit e; theXmlC onfig: TXm lConfig);
  88   begin
  89     XsdEngin e := theXs dEngine;
  90     XmlConfi g := theXm lConfig;
  91   end;
  92  
  93   procedure  TVlerDasCl aim.SetXml Namespace( prefix: St ring; URI:  String);
  94   begin
  95     Namespac ePrefix :=  prefix;
  96     Namespac eURI := UR I;
  97   end;
  98  
  99   procedure  TVlerDasCl aim.SetRoo tPanel(the RootPanel:  TPanel);
  100   begin
  101     RootPane l := theRo otPanel;
  102   end;
  103  
  104   procedure  TVlerDasCl aim.SetAtt achments(l istOfAttac hments: TL ist);
  105   begin
  106     Attachme ntsList :=  listOfAtt achments;
  107   end;
  108  
  109   function T VlerDasCla im.ToXml:  IXMLDocume nt;
  110   const
  111   // Patch 1 87 notes f or in-hous e exams:   In Patch 1 86 (versio n 1.0 DBQs ), schema  validation  of medica l data by  VBMS was n ot done.   Patch 187  was origin ally going  to
  112   // send da ta that wo uld pass V BMS valida tion.  How ever, sche ma validat ion requir es updatin g header i nformation  in CAPRI,  and that  cannot hap pen on the  same
  113   // timelin e that the  BEST team  needs to  update the ir medical  DBQs to c omply with  legal or  business.   So the de cision was  made to a lter CAPRI  to send 1 .0 DBQ dat a
  114   // so VBMS  will igno re validat ion.  (Sho rtest time line, VBMS  could not  make the  change for  months).   In discus sions with  all the g roups, it  appears ve rsion numb er
  115   // is not  the key to  schema va lidation,  it is the  constant d efined bel ow as NS_C LD.  So th e constant  NS_CLD wi ll be chan ged to sen d the valu e used in  the 1.0 DB Qs and
  116   // this sh ould elimi nate schem a validati on and all ow VBMS to  process a ll DBQs as  well as t he BEST te am to make  periodic  updates th at don’t h ave to coi ncide with
  117   // CAPRI r eleases.   All other  changes in cluding ne w fields a nd other X ML changes  are still  included  in the XML  – the nam espace NS_ CLD will b e the only  change to
  118   // elimina te schema  validation  but other  data will  appear th e same as  what is in  the Claim s IEPD 1.1 .2.
  119   //NS_CLD =  'http://v ler. DNS     /vler/sche mas/health /clinicalD ocuments/c linicalAss essments/c pExams/Cla im/1.0';    // JRL 10/ 17/14
  120   //NS_CLD =  'http://v ler. DNS     /vler/sche mas/health /clinicalD ocuments/c linicalAss essments/c pExams/Cla im/1.1.2';     // CodeCR5 63 JRL 8/4 /14
  121   //NS_VLER  = 'http:// DNS     /vler/sche mas/vlerSu persetSche ma/0.9/vle r';             // CodeCR5 63 JRL 7/2 9/14
  122   //DOCUMENT _TYPE_VERS ION = '1.1 ';                                                     // CodeCR5 63 JRL 8/1 /14
  123       NS_CLD = ' http://vle r. DNS     /vler/sche mas/health /clinicalD ocuments/c linicalAss essments/c pExams/1.3 ';    // revert  to patch 1 86 namespa ce so sche ma validat ion is ign ored
  124     NS_NC =  'http://ni em.gov/nie m/niem-cor e/2.0';
  125       NS_VLER =  'http:// DNS     /vler/sche mas/vlerSu persetSche ma/0.7/vle r';             // JRL 11/ 3/14 Rever t to 1.0 h eaders
  126     NS_NIEM_ XSD = 'htt p://niem.g ov/niem/pr oxy/xsd/2. 0';
  127     NS_S = ' http://nie m.gov/niem /structure s/2.0';
  128     NS_XSI =  'http://w ww.w3.org/ 2001/XMLSc hema-insta nce';
  129     DOCUMENT _TYPE_VERS ION = '1.0 ';                                                     // JRL 11/ 3/14 Rever t to 1.0 h eaders
  130  
  131   var
  132     xml: IXM LDocument;
  133  
  134     xmlNode:  IXMLNode;
  135  
  136     commonDa ta: IXMLNo de;
  137     medicalD ata: IXMLN ode;
  138     attachme nts: IXMLN ode;
  139  
  140     i: Integ er;
  141     anAttach ment: TVle rDasAttach ment;
  142   begin
  143     xml := T XMLDocumen t.Create(N il);
  144     xml.Acti ve := True ;
  145     xml.Vers ion := '1. 0';                                                               // CodeCR5 63 JRL 7/2 9/14
  146     xml.Enco ding := 'U TF-8';
  147     xml.Docu mentElemen t := xml.C reateNode( 'cld:Claim ', ntEleme nt, NS_CLD );
  148     xml.Docu mentElemen t.DeclareN amespace(' nc', NS_NC );
  149     xml.Docu mentElemen t.DeclareN amespace(' vler', NS_ VLER);
  150     xml.Docu mentElemen t.DeclareN amespace(' niem-xsd', NS_NIEM_XS D);
  151     xml.Docu mentElemen t.DeclareN amespace(' s', NS_S);
  152     xml.Docu mentElemen t.DeclareN amespace(' xsi', NS_X SI);
  153     if Lengt h(Namespac ePrefix) >  0 then
  154     begin
  155   //  Namesp aceURI :=  ReformatNa mespaceIfN eeded(Name spaceURI);                       // CodeCR5 63 JRL 9/2 /14
  156                                                                                           // Removed  11/3/14 t o revert t o 1.0 head ers
  157       xml.Do cumentElem ent.Declar eNamespace (Namespace Prefix, Na mespaceURI );
  158     end;
  159  
  160     // remov ed code to  get the v ersion fro m the dbq  files.  Ju st hard co de it abov e.  If the  common da ta
  161     // secti on changes , then the  constants  above (pa th and ver sion) need  to be upd ated too.
  162     //  xml. DocumentEl ement.AddC hild('Docu mentTypeVe rsion').No deValue :=  DocumentT ypeVersion
  163     xml.Docu mentElemen t.AddChild ('Document TypeVersio n').NodeVa lue := DOC UMENT_TYPE _VERSION;
  164     xml.Docu mentElemen t.AddChild ('ClaimID' ).NodeValu e := Claim ID;
  165  
  166     commonDa ta := xml. DocumentEl ement.AddC hild('Comm onData');
  167     xmlNode  := commonD ata.AddChi ld('nc:Doc ument');
  168     xmlNode. AddChild(' nc:Documen tCreationD ate').AddC hild('nc:D ateTime'). NodeValue  := Documen tCreationD ate;
  169     xmlNode. AddChild(' nc:Documen tDescripti onText').N odeValue : = Document TitleText;
  170     xmlNode. AddChild(' nc:Documen tIdentific ation').Ad dChild('nc :Identific ationID'). NodeValue  := Documen tIdentific ationID;
  171     xmlNode. AddChild(' nc:Documen tStatus'). AddChild(' nc:StatusT ext').Node Value := S tatusText;   // Remov ed hardcod ing of "Co mpleted" C odeCR563 J RL 6/13/14
  172     xmlNode. AddChild(' nc:Documen tTitleText ').NodeVal ue := Docu mentTitleT ext;
  173  
  174     // add i n exam det ail    
  175     xmlNode  := commonD ata.AddChi ld('vler:E xamDetail' );                               // CodeCR5 63 JRL 6/9 /14
  176     xmlNode. AddChild(' vler:Physi calSource' ).NodeValu e := Physi calSource;            // CodeCR5 63 JRL 6/9 /14
  177     xmlNode. AddChild(' vler:ExamI d').NodeVa lue := Exa mID;                             // CodeCR5 63 JRL 6/9 /14
  178     xmlNode. AddChild(' vler:Exami nerType'). NodeValue  := Examine rType;                // CodeCR5 63 JRL 6/9 /14
  179     xmlNode. AddChild(' vler:Contr actType'). NodeValue  := Contrac tType;                // CodeCR5 63 JRL 6/9 /14
  180     with xml Node.AddCh ild('vler: StatusDate ') do                                       // CodeCR5 63 JRL 8/4 /14
  181     begin                                                                                 // CodeCR5 63 JRL 8/4 /14
  182       AddChi ld('nc:Dat eTime').No deValue :=  StatusDat e;                               // CodeCR5 63 JRL 8/4 /14
  183     end;                                                                                  // CodeCR5 63 JRL 8/4 /14
  184   //  xmlNod e.AddChild ('vler:Sta tusDate'). NodeValue  := StatusD ate;                    // CodeC R563 JRL 6 /9/14
  185     xmlNode. AddChild(' vler:Comme nts').Node Value := C omments;                         // CodeCR5 63 JRL 6/9 /14
  186     
  187     xmlNode  := commonD ata.AddChi ld('vler:C lient');
  188     xmlNode. Attributes ['s:id'] : = 'client' ;
  189     with xml Node.AddCh ild('vler: ClientIden tifier') d o
  190     begin
  191       AddChi ld('nc:Ide ntificatio nID').Node Value := C lientIdent ificationI D;
  192       AddChi ld('vler:A ssigningAu thority'). NodeValue  := ClientA ssigningAu thority;
  193     end;
  194     xmlNode. AddChild(' vler:Clien tStatus'). AddChild(' vler:Clien tStatusTex t').NodeVa lue := 'OK ';
  195     xmlNode. AddChild(' nc:RoleOfP ersonRefer ence').Att ributes['s :ref'] :=  'one';
  196  
  197     xmlNode  := commonD ata.AddChi ld('vler:S erviceProv ider');
  198     xmlNode. Attributes ['s:id'] : = 'service _provider' ;
  199     with xml Node.AddCh ild('vler: PersonIden tifier') d o
  200     begin
  201       AddChi ld('nc:Ide ntificatio nID').Node Value := S erviceProv iderIdenti ficationID ;
  202       AddChi ld('vler:A ssigningAu thority'). NodeValue  := Service ProviderAs signingAut hority;
  203       AddChi ld('nc:Ide ntificatio nJurisdict ionText'). NodeValue  := 'CAPRI  User IEN';
  204     end;
  205     xmlNode. AddChild(' vler:Servi ceProvider RoleTitle' ).NodeValu e := 'Phys ician';
  206     xmlNode. AddChild(' nc:RoleOfP ersonRefer ence').Att ributes['s :ref'] :=  'two';
  207  
  208     // add i n approver  detail
  209     xmlNode  := commonD ata.AddChi ld('vler:A pprover');                                  // CodeCR5 63 JRL 6/9 /14
  210     xmlNode. Attributes ['s:id'] : = 'approve r';                                         // CodeCR5 63 JRL 6/9 /14
  211     xmlNode. AddChild(' PersonIden tifier').N odeValue : = '';                            // CodeCR5 63 JRL 6/9 /14
  212     xmlNode. AddChild(' vler:Servi ceProvider RoleTitle' ).NodeValu e := 'EXAM INER';     // CodeCR5 63 JRL 6/9 /14
  213     xmlNode. AddChild(' nc:RoleOfP ersonRefer ence').Att ributes['s :ref'] :=  'three';   // CodeCR5 63 JRL 6/9 /14
  214  
  215     xmlNode  := commonD ata.AddChi ld('nc:Per son');                                      // CodeCR5 63 JRL 6/9 /14
  216     xmlNode. Attributes ['s:id'] : = 'three';                                             // CodeCR5 63 JRL 6/9 /14
  217     with xml Node.AddCh ild('nc:Pe rsonName')  do                                         // CodeCR5 63 JRL 6/9 /14
  218     begin                                                                                 // CodeCR5 63 JRL 6/9 /14
  219       AddChi ld('nc:Per sonGivenNa me').NodeV alue := Ap proverFirs tName;                // CodeCR5 63 JRL 6/9 /14
  220       AddChi ld('nc:Per sonMiddleN ame').Node Value := A pproverMid dleName;              // CodeCR5 63 JRL 6/9 /14
  221       AddChi ld('nc:Per sonSurName ').NodeVal ue := Appr overLastNa me;                   // CodeCR5 63 JRL 6/9 /14
  222     end;                                                                                  // CodeCR5 63 JRL 6/9 /14
  223  
  224     xmlNode  := commonD ata.AddChi ld('nc:Per son');
  225     xmlNode. Attributes ['s:id'] : = 'two';
  226     with xml Node.AddCh ild('nc:Pe rsonName')  do
  227     begin
  228       AddChi ld('nc:Per sonGivenNa me').NodeV alue := Pr oviderFirs tName;
  229       AddChi ld('nc:Per sonMiddleN ame').Node Value := P roviderMid dleName;
  230       AddChi ld('nc:Per sonSurName ').NodeVal ue := Prov iderLastNa me;
  231     end;
  232  
  233     xmlNode  := commonD ata.AddChi ld('nc:Per son');
  234     xmlNode. Attributes ['s:id'] : = 'one';
  235     xmlNode. AddChild(' nc:PersonB irthDate') .AddChild( 'nc:Date') .NodeValue  := Patien tDateOfBir th;
  236     with xml Node.AddCh ild('nc:Pe rsonName')  do
  237     begin
  238       AddChi ld('nc:Per sonGivenNa me').NodeV alue := Pa tientFirst Name;
  239       AddChi ld('nc:Per sonMiddleN ame').Node Value := P atientMidd leName;
  240       AddChi ld('nc:Per sonSurName ').NodeVal ue := Pati entLastNam e;
  241     end;
  242     xmlNode. AddChild(' nc:PersonS exCode').N odeValue : = PatientG ender;
  243     xmlNode. AddChild(' nc:PersonS SNIdentifi cation').A ddChild('n c:Identifi cationID') .NodeValue  := Patien tSSN;
  244  
  245     xmlNode  := commonD ata.AddChi ld('nc:Fac ility');
  246     with xml Node.AddCh ild('nc:Fa cilityIden tification ') do
  247     begin
  248       AddChi ld('nc:Ide ntificatio nID').Node Value := F acilityIde ntificatio nID;
  249       AddChi ld('nc:Ide ntificatio nJurisdict ionText'). NodeValue  := Facilit yIdentific ationText;
  250     end;
  251     xmlNode. AddChild(' nc:Facilit yName').No deValue :=  FacilityN ame;
  252  
  253     with com monData.Ad dChild('vl er:Service ProviderCl ientAssoci ation') do
  254     begin
  255       AddChi ld('vler:S erviceProv iderRefere nce').Attr ibutes['s: ref'] := ' service_pr ovider';
  256       AddChi ld('vler:C lientRefer ence').Att ributes['s :ref'] :=  'client';
  257     end;
  258     
  259  
  260     medicalD ata := xml .DocumentE lement.Add Child('Med icalData') ;
  261     RenderMe dicalDataX ml(medical Data);
  262  
  263     attachme nts := xml .DocumentE lement.Add Child('Att achments') ;
  264  
  265     if (Atta chmentsLis t <> Nil)  and (Attac hmentsList .Count > 0 ) then
  266     begin
  267       for i  := 0 to At tachmentsL ist.Count  - 1 do
  268       begin
  269         anAt tachment : = Attachme ntsList[i] ;
  270         with  attachmen ts.AddChil d('nc:Atta chment') d o
  271         begi n
  272           Ad dChild('nc :BinaryBas e64Object' ).NodeValu e := anAtt achment.Bi naryBase64 Object;
  273           Ad dChild('nc :BinaryDes criptionTe xt').NodeV alue := an Attachment .BinaryDes criptionTe xt;
  274           Ad dChild('nc :BinaryFor matStandar dName').No deValue :=  anAttachm ent.Binary FormatStan dardName;
  275           Ad dChild('nc :BinaryLoc ationURI') .NodeValue  := anAtta chment.Bin aryLocatio nURI;
  276           Ad dChild('nc :BinarySiz eValue').N odeValue : = anAttach ment.Binar ySizeValue ;
  277           Ad dChild('nc :BinaryCat egoryText' ).NodeValu e := anAtt achment.Bi naryCatego ryText;
  278         end;
  279       end;
  280     end;
  281  
  282     Result : = FixDelph iXmlBugs(x ml);
  283   end;
  284  
  285   {
  286   This helpe r function  currently  fixes:
  287     #1 - Ina ppropriate  tagging o f <ncsd:Se lected> ;  changes th e tag <ncs d:Selected > to <Sele cted>
  288   }
  289   function T VlerDasCla im.FixDelp hiXmlBugs( xmlDocumen t: IXMLDoc ument): IX MLDocument ;
  290   var
  291     stringSt ream: TStr ingStream;
  292     xmlStrin g: WideStr ing;
  293   begin
  294     stringSt ream := TS tringStrea m.Create(' ');
  295     xmlDocum ent.SaveTo Stream(str ingStream) ;
  296  
  297     // #1 -  change <nc sd:Selecte d> to <Sel ected>
  298     xmlStrin g := Strin gReplace(s tringStrea m.DataStri ng, 'ncsd: Selected>' , 'Selecte d>',[rfRep laceAll]);
  299  
  300     FreeAndN il(stringS tream);
  301     stringSt ream := TS tringStrea m.Create(x mlString);
  302  
  303     Result : = TXMLDocu ment.Creat e(Nil);
  304     Result.L oadFromStr eam(string Stream);
  305  
  306     Result : = (Result  as IXMLDoc ument);
  307   end;
  308  
  309   procedure  TVlerDasCl aim.Render MedicalDat aXml(XmlNo de: IXMLNo de);
  310   var
  311     i: Integ er;
  312     componen t: TCompon ent;
  313     componen tName: Str ing;
  314     complexT ype: TXsdC omplexType ;
  315     xmlBindi ngs: TXmlC omponentBi ndings;
  316  
  317     nsPrefix : String;
  318     rootTag:  String;
  319  
  320     parentNo de: IXmlNo de;
  321   begin
  322     if RootP anel = Nil  then
  323       Exit;
  324  
  325     nsPrefix  := XmlCon fig.GetVal ue(TXmlCon fig.NAMESP ACE_PREFIX );
  326     rootTag  := XmlConf ig.GetValu e(TXmlConf ig.ELEMENT _NAME);
  327  
  328     parentNo de := XmlN ode.AddChi ld(nsPrefi x + ':' +  rootTag);
  329     xmlBindi ngs := TXm lComponent Bindings.C reate(XmlC onfig, par entNode);
  330  
  331     for i :=  0 to root Panel.Comp onentCount  - 1 do
  332     begin
  333       compon ent := roo tPanel.Com ponents[i] ;
  334       compon entName :=  component .Name;
  335  
  336       if Xsd Engine.Con tainsCompo nent(compo nentName)  = False th en
  337         cont inue;
  338  
  339       comple xType := X sdEngine.G etXsdCompl exType(com ponentName );
  340  
  341       xmlBin dings.AddX mlNode(com ponent, co mplexType) ;
  342     end; //  for i := 0  to rootPa nel.Compon entCount -  1 do
  343  
  344   end; // fu nction TXm lEngine.Re nderMedica lDataXml(r ootPanel:  TPanel): T StringList ;
  345  
  346   class func tion TVler DasAttachm ent.Encode ToBase64(s tream: TSt ream): Wid eString;
  347   var
  348     encoder:  TIdEncode rMime;
  349   begin
  350     try
  351       encode r := TIdEn coderMIME. Create(App lication);             // LMS :  Create wit h owner so  App will  free in ca se its lef t over
  352       Result  := encode r.Encode(s tream, str eam.Size);
  353     except
  354       on E:  Exception  do
  355         Resu lt := '';
  356     end;
  357  
  358     if encod er <> Nil  then
  359       FreeAn dNil(encod er);
  360   end;
  361  
  362   class func tion TVler DasAttachm ent.Decode ToBase64(T extIn : Wi deString):  TStream;
  363   var
  364     Decoder:  TIdDecode rMime;
  365     DecodedS tream: TMe moryStream ;
  366   begin
  367     Result : = nil;
  368     try
  369       Decode dStream:=  TMemoryStr eam.Create ;
  370       Decode r := TIdDe coderMime. Create(App lication);
  371       Decode r.DecodeBe gin(Decode dStream);
  372       Decode r.Decode(T extIn);
  373       Decode r.DecodeEn d;
  374       Result  := Decode dStream;
  375     except
  376       on E:  Exception  do
  377     end;
  378  
  379     if Decod er <> Nil  then
  380       FreeAn dNil(Decod er);
  381   end;
  382  
  383   //-------- ---------- ---------- ---------- ---------- ---------- ---------- ----------
  384   // Modify  the URI if  the URI i s in the f ormat of:   
  385   //     "http://vl er. DNS     /vler/sche mas/health /clinicalD ocuments/c linicalAss essments/c pExams/1.3 /HearingLo ssAndTinni tus"
  386   //
  387   // From: x mlns:hlat= "http://vl er. DNS     /vler/sche mas/health /clinicalD ocuments/c linicalAss essments/c pExams/1.3 /HearingLo ssAndTinni tus">
  388   //     To: xmlns: hlat="http ://vler. DNS     /vler/sche mas/health /clinicalD ocuments/c linicalAss essments/c pExams/Hea ringLossAn dTinnitus/ 1.3">
  389   //-------- ---------- ---------- ---------- ---------- ---------- ---------- ----------
  390   function T VlerDasCla im.Reforma tNamespace IfNeeded(C urrentName space: Str ing): Stri ng;
  391   var
  392     cpExamsP osition,Ve rsionPosit ion, DBQNa mePosition , OutValue  : Integer ;
  393     DBQNameS tr, Versio nStr, Upda tedStr : s tring;
  394   begin
  395     cpExamsP osition :=  Pos('cpEx ams',Curre ntNamespac e);
  396     VersionP osition :=  cpExamsPo sition + 8 ;  // go t o first ch aracter pa st next sl ash
  397     if TrySt rToInt(Cop y(CurrentN amespace,V ersionPosi tion,1),Ou tValue) th en
  398     begin //  convert
  399       DBQNam ePosition  := Version Position +  4;
  400       Versio nStr := Co py(Current Namespace, VersionPos ition,3);
  401       DBQNam eStr := Co py(Current Namespace, DBQNamePos ition,(len gth(Curren tNameSpace )-DBQNameP osition+1) );
  402       Update dStr := Co py(Current Namespace, 1,(Version Position-1 )) + DBQNa meStr + '/ ' + Versio nStr;
  403       Result  := Update dStr;
  404     end
  405     else
  406       Result  := Curren tNamespace ;
  407   end;
  408     
  409   end.