Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: HDISVS02

HDISVS02.m

Go to the documentation of this file.
  1. HDISVS02 ;BPFO/JRP - PROCESS RECEIVED XML DATA;12/20/2004
  1. ;;1.0;HEALTH DATA & INFORMATICS;;Feb 22, 2005
  1. ;
  1. TERM(DATA,EINDX,AINDX,SYSPTR,FFPTR,ERRARR) ;Process 'Term' portion of XML document
  1. ; Input : DATA - Array reference from which the 'File' element
  1. ; begins (closed root)
  1. ; EINDX - Element index array (closed root)
  1. ; AINDX - Attribute index array (closed root)
  1. ; SYSPTR - Pointer to HDIS SYSTEM file (#7118.21)
  1. ; FFPTR - Pointer to HDIS FILE/FIELD file (#7115.6)
  1. ; Derived from 'FileNumber' & 'FieldNumber' element
  1. ; ERRARR - Error array (closed root)
  1. ;Output : None
  1. ; @ERRARR@(x) = Error text (if applicable)
  1. ; Notes : Existance/validity of input assumed (internal call)
  1. N INDX,REP,TERM,IREF,VUID,TMP,OOPS,TERMPTR,FILEARR,X
  1. S INDX=@EINDX@("Term")
  1. S REP=0
  1. F S REP=+$O(@DATA@(INDX,REP)) Q:'REP D
  1. .S OOPS=0
  1. .S TERMPTR=0
  1. .;Get elements
  1. .S TERM=$G(@DATA@(INDX,REP,@EINDX@("TermName"),1,"V"))
  1. .S IREF=$G(@DATA@(INDX,REP,@EINDX@("FacilityInternalReference"),1,"V"))
  1. .S VUID=$G(@DATA@(INDX,REP,@EINDX@("VUID"),1,"V"))
  1. .;Validate elements
  1. .;VUID allowed to be null (in most cases they are)
  1. .F TMP="TERM","IREF" I $G(@TMP)="" D
  1. ..S Y="TermName"
  1. ..I TMP="IREF" S Y="FacilityInternalReference"
  1. ..S X="XML element '"_Y_"' for repetition number "_REP_" of 'Term' "
  1. ..I TMP="TERM" S X="Repetition number "_REP_" of XML element 'Term' "
  1. ..I TMP'="TERM" S X=X_"("_TERM_") "
  1. ..S X=X_"did not have a value"
  1. ..D ADDERR^HDISVC00(X,ERRARR)
  1. ..S OOPS=1
  1. .;Problem found - quit
  1. .I OOPS Q
  1. .;VUID passed - ignore
  1. .I VUID'="" Q
  1. .;Convert term to upper case
  1. .S TERM=$$UP^XLFSTR(TERM)
  1. .;Known term/concept
  1. .K FILEARR
  1. .S FILEARR(FFPTR)=""
  1. .K TERMPTR
  1. .I $$GETTERM^HDISVF04(TERM,.FILEARR,.TERMPTR) D
  1. ..;Get VUID
  1. ..S VUID=""
  1. ..S X=$$GETVUID^HDISVF04(TERMPTR,.VUID)
  1. ..;Make sure VUID has a value
  1. ..I VUID="" D
  1. ...S X="Entry number "_TERMPTR_" in HDIS TERM/CONCEPT VUID "
  1. ...S X=X_"ASSOCIATION file (#7118.11) does not have a VUID."
  1. ...S X=X_" Repetition "_REP_" of 'Term' ("_TERM_")."
  1. ...D ADDERR^HDISVC00(X,ERRARR)
  1. ...S OOPS=1
  1. .;Problem found - quit
  1. .I OOPS Q
  1. .;Assign non-standard VUID
  1. .I VUID="" D
  1. ..;Calculate non-standard VUID
  1. ..S VUID=$$CALCNSV^HDISVF03()
  1. ..I VUID="" D Q
  1. ...S TMP="Unable to calculate non-standard VUID for repetition number "
  1. ...S TMP=TMP_REP_" of 'Term' ("_TERM_")"
  1. ...D ADDERR^HDISVC00(TMP,ERRARR)
  1. ...S OOPS=1
  1. ..;Create entry in Term/Concept file
  1. ..K FILEARR
  1. ..S FILEARR(FFPTR)=""
  1. ..K TERMPTR
  1. ..I '$$ADDTERM^HDISVF04(TERM,VUID,.FILEARR,0,1,$$NOW^XLFDT(),0,.TERMPTR) D
  1. ...S TMP="Unable to create entry in HDIS TERM/CONCEPT VUID "
  1. ...S TMP=TMP_"ASSOCIATION file (#7118.11) for repetition number "
  1. ...S TMP=TMP_REP_" of 'Term' ("_TERM_"). VUID was "_VUID_"."
  1. ...D ADDERR^HDISVC00(TMP,ERRARR)
  1. ...S OOPS=1
  1. ..;Wait 1 second - resolve global cache problem
  1. ..H 1
  1. .;Problem found - quit
  1. .I OOPS Q
  1. .;Create entry in Facility Term/Concept file
  1. .I '$$FINDFAC^HDISVF08(SYSPTR,FFPTR,TERMPTR,IREF,1) D
  1. ..S TMP="Unable to create entry in HDIS FACILITY TERM/CONCEPT "
  1. ..S TMP="ASSOCIATION file (#7118.22) for repetition number "_REP
  1. ..S TMP=TMP_" of 'Term' ("_TERM_"). VUID was "_VUID_"."
  1. ..D ADDERR^HDISVC00(TMP,ERRARR)
  1. ..S OOPS=1
  1. .;Problem found - quit
  1. .I OOPS Q
  1. Q