1 | HDISVS02 ;BPFO/JRP - PROCESS RECEIVED XML DATA;12/20/2004
|
---|
2 | ;;1.0;HEALTH DATA & INFORMATICS;;Feb 22, 2005
|
---|
3 | ;
|
---|
4 | TERM(DATA,EINDX,AINDX,SYSPTR,FFPTR,ERRARR) ;Process 'Term' portion of XML document
|
---|
5 | ; Input : DATA - Array reference from which the 'File' element
|
---|
6 | ; begins (closed root)
|
---|
7 | ; EINDX - Element index array (closed root)
|
---|
8 | ; AINDX - Attribute index array (closed root)
|
---|
9 | ; SYSPTR - Pointer to HDIS SYSTEM file (#7118.21)
|
---|
10 | ; FFPTR - Pointer to HDIS FILE/FIELD file (#7115.6)
|
---|
11 | ; Derived from 'FileNumber' & 'FieldNumber' element
|
---|
12 | ; ERRARR - Error array (closed root)
|
---|
13 | ;Output : None
|
---|
14 | ; @ERRARR@(x) = Error text (if applicable)
|
---|
15 | ; Notes : Existance/validity of input assumed (internal call)
|
---|
16 | N INDX,REP,TERM,IREF,VUID,TMP,OOPS,TERMPTR,FILEARR,X
|
---|
17 | S INDX=@EINDX@("Term")
|
---|
18 | S REP=0
|
---|
19 | F S REP=+$O(@DATA@(INDX,REP)) Q:'REP D
|
---|
20 | .S OOPS=0
|
---|
21 | .S TERMPTR=0
|
---|
22 | .;Get elements
|
---|
23 | .S TERM=$G(@DATA@(INDX,REP,@EINDX@("TermName"),1,"V"))
|
---|
24 | .S IREF=$G(@DATA@(INDX,REP,@EINDX@("FacilityInternalReference"),1,"V"))
|
---|
25 | .S VUID=$G(@DATA@(INDX,REP,@EINDX@("VUID"),1,"V"))
|
---|
26 | .;Validate elements
|
---|
27 | .;VUID allowed to be null (in most cases they are)
|
---|
28 | .F TMP="TERM","IREF" I $G(@TMP)="" D
|
---|
29 | ..S Y="TermName"
|
---|
30 | ..I TMP="IREF" S Y="FacilityInternalReference"
|
---|
31 | ..S X="XML element '"_Y_"' for repetition number "_REP_" of 'Term' "
|
---|
32 | ..I TMP="TERM" S X="Repetition number "_REP_" of XML element 'Term' "
|
---|
33 | ..I TMP'="TERM" S X=X_"("_TERM_") "
|
---|
34 | ..S X=X_"did not have a value"
|
---|
35 | ..D ADDERR^HDISVC00(X,ERRARR)
|
---|
36 | ..S OOPS=1
|
---|
37 | .;Problem found - quit
|
---|
38 | .I OOPS Q
|
---|
39 | .;VUID passed - ignore
|
---|
40 | .I VUID'="" Q
|
---|
41 | .;Convert term to upper case
|
---|
42 | .S TERM=$$UP^XLFSTR(TERM)
|
---|
43 | .;Known term/concept
|
---|
44 | .K FILEARR
|
---|
45 | .S FILEARR(FFPTR)=""
|
---|
46 | .K TERMPTR
|
---|
47 | .I $$GETTERM^HDISVF04(TERM,.FILEARR,.TERMPTR) D
|
---|
48 | ..;Get VUID
|
---|
49 | ..S VUID=""
|
---|
50 | ..S X=$$GETVUID^HDISVF04(TERMPTR,.VUID)
|
---|
51 | ..;Make sure VUID has a value
|
---|
52 | ..I VUID="" D
|
---|
53 | ...S X="Entry number "_TERMPTR_" in HDIS TERM/CONCEPT VUID "
|
---|
54 | ...S X=X_"ASSOCIATION file (#7118.11) does not have a VUID."
|
---|
55 | ...S X=X_" Repetition "_REP_" of 'Term' ("_TERM_")."
|
---|
56 | ...D ADDERR^HDISVC00(X,ERRARR)
|
---|
57 | ...S OOPS=1
|
---|
58 | .;Problem found - quit
|
---|
59 | .I OOPS Q
|
---|
60 | .;Assign non-standard VUID
|
---|
61 | .I VUID="" D
|
---|
62 | ..;Calculate non-standard VUID
|
---|
63 | ..S VUID=$$CALCNSV^HDISVF03()
|
---|
64 | ..I VUID="" D Q
|
---|
65 | ...S TMP="Unable to calculate non-standard VUID for repetition number "
|
---|
66 | ...S TMP=TMP_REP_" of 'Term' ("_TERM_")"
|
---|
67 | ...D ADDERR^HDISVC00(TMP,ERRARR)
|
---|
68 | ...S OOPS=1
|
---|
69 | ..;Create entry in Term/Concept file
|
---|
70 | ..K FILEARR
|
---|
71 | ..S FILEARR(FFPTR)=""
|
---|
72 | ..K TERMPTR
|
---|
73 | ..I '$$ADDTERM^HDISVF04(TERM,VUID,.FILEARR,0,1,$$NOW^XLFDT(),0,.TERMPTR) D
|
---|
74 | ...S TMP="Unable to create entry in HDIS TERM/CONCEPT VUID "
|
---|
75 | ...S TMP=TMP_"ASSOCIATION file (#7118.11) for repetition number "
|
---|
76 | ...S TMP=TMP_REP_" of 'Term' ("_TERM_"). VUID was "_VUID_"."
|
---|
77 | ...D ADDERR^HDISVC00(TMP,ERRARR)
|
---|
78 | ...S OOPS=1
|
---|
79 | ..;Wait 1 second - resolve global cache problem
|
---|
80 | ..H 1
|
---|
81 | .;Problem found - quit
|
---|
82 | .I OOPS Q
|
---|
83 | .;Create entry in Facility Term/Concept file
|
---|
84 | .I '$$FINDFAC^HDISVF08(SYSPTR,FFPTR,TERMPTR,IREF,1) D
|
---|
85 | ..S TMP="Unable to create entry in HDIS FACILITY TERM/CONCEPT "
|
---|
86 | ..S TMP="ASSOCIATION file (#7118.22) for repetition number "_REP
|
---|
87 | ..S TMP=TMP_" of 'Term' ("_TERM_"). VUID was "_VUID_"."
|
---|
88 | ..D ADDERR^HDISVC00(TMP,ERRARR)
|
---|
89 | ..S OOPS=1
|
---|
90 | .;Problem found - quit
|
---|
91 | .I OOPS Q
|
---|
92 | Q
|
---|