init routine for the CCR Dictionary
This commit is contained in:
parent
5e1f9b172e
commit
81a723fcc8
112
p/C0CDIC.m
112
p/C0CDIC.m
|
@ -97,4 +97,116 @@ LOAD ; LOAD VARIABLE NAMES AND XPATH IN ^C0CDIC(170
|
|||
. I $D(^TMP("DIERR",$J)) U $P BREAK
|
||||
. W "LOADING:",C0CI," ",C0CARY(C0CI),!
|
||||
Q
|
||||
;
|
||||
FIELDS(C0CFRTN,C0CF) ; RETURNS AN ARRAY OF THE FIELDS IN FILE C0CF,
|
||||
; C0CFRTN IS PASSED BY NAME, C0CF IS PASSED BY VALUE
|
||||
;
|
||||
N C0CFI,C0CFJ ;INNER LOOP, OUTER LOOP
|
||||
N C0CFN ; FIELD NAME
|
||||
S C0CFI=0 S C0CFJ=C0CF
|
||||
K @C0CFRTN ; CLEAR THE RETURN ARRAY
|
||||
F Q:$P(C0CFJ,".",1)'=C0CF D ; FOR THE C0CF FILE AND ALL SUBFILES INCLUSIVE
|
||||
. F S C0CFI=$O(^DD(C0CFJ,C0CFI)) Q:+C0CFI=0 D ; EVERY FIELD
|
||||
. . ;W C0CFJ," ",C0CFI,!
|
||||
. . S C0CFN=$P(^DD(C0CFJ,C0CFI,0),"^",1) ;PULL FIELD NAME FROM ^DD
|
||||
. . I $D(@C0CFRTN@(C0CFN)) D ; IS THIS A DUPLICATE?
|
||||
. . . ;W "DUPLICATE FOUND! ",C0CFJ," ",C0CFI," ",C0CFN,!,@C0CFRTN@(C0CFN),!
|
||||
. . . S @C0CFRTN@("M",@C0CFRTN@(C0CFN),C0CFN)=C0CFJ_"^"_C0CFI
|
||||
. . E S @C0CFRTN@(C0CFN)=C0CFJ_"^"_C0CFI
|
||||
. S C0CFJ=$O(^DD(C0CFJ)) ; NEXT SUBFILE
|
||||
Q
|
||||
;
|
||||
GET(GRTN,GFILE,GIEN) ; RETURN THE DICTIONARY RECORD GIEN IN ARRAY GRTN, PASSED
|
||||
; BY NAME
|
||||
;
|
||||
N C0CTMP,C0CI,C0CJ,C0CREF,C0CNAME
|
||||
S C0CREF=GIEN_"," ; OPEN ROOT REFERENCE INTO FILE
|
||||
D GETS^DIQ(GFILE,C0CREF,"**","","C0CTMP")
|
||||
D FIELDS(GRTN,GFILE) ;GET ALL THE FIELD NAMES FOR THE FILE
|
||||
S (C0CI,C0CJ)=""
|
||||
F S C0CJ=$O(C0CTMP(C0CJ)) Q:C0CJ="" D ; FOR ALL SUBFILES
|
||||
. S C0CREF=$O(C0CTMP(C0CJ,"")) ; RECORD REFERENCE
|
||||
. F S C0CI=$O(C0CTMP(C0CJ,C0CREF,C0CI)) Q:C0CI="" D ; ARRAY OF FIELDS
|
||||
. . ;W C0CJ," ",C0CI,!
|
||||
. . S C0CNAME=$P(^DD(C0CJ,C0CI,0),"^",1) ;PULL THE FIELD NAME
|
||||
. . S $P(@GRTN@(C0CNAME),"^",3)=C0CTMP(C0CJ,C0CREF,C0CI) ;RETURN VALUE IN P3
|
||||
Q
|
||||
;
|
||||
INIT ; INITIALIZE CCR DICTIONARY BASED ON VARIABLE NAMES
|
||||
;
|
||||
; CHEAT SHEET FOR VARIABLE NAMES IN ^C0CDIC(170.xx,
|
||||
; THIS IS WHAT WILL BE IN C0CA FOR EACH DICTIONARY ENTRY
|
||||
;G1("CODING")="170^8"
|
||||
;G1("DATA ELEMENT")="170^7"
|
||||
;G1("DESCRIPTION")="170^3"
|
||||
;G1("ID")="170^1"
|
||||
;G1("M","170^8","CODING")="170.08^.01"
|
||||
;G1("MAPPING METHOD")="170.08^1"
|
||||
;G1("SECTION")="170^10"
|
||||
;G1("SOURCE")="170^4"
|
||||
;G1("STATUS")="170^9"
|
||||
;G1("TYPE")="170^6"
|
||||
;G1("VARIABLE")="170^.01"
|
||||
;G1("XPATH")="170^2"
|
||||
;
|
||||
N C0CZA,C0CZX,C0CN,C0CSTAT
|
||||
S C0CZX=0
|
||||
S C0CSTAT=0 ; INIT STATUS SET FLAG
|
||||
F S C0CZX=$O(^C0CDIC(170,C0CZX)) Q:+C0CZX=0 D ; FOR EACH DICT ENTRY
|
||||
. ;W C0CZX,!
|
||||
. K C0CA ; CLEAR OUT THE LAST ONE
|
||||
. D GET("C0CA",170,C0CZX) ; GET VARIABLE HASH
|
||||
. S C0CN=$$ZVALUE("VARIABLE") ;NAME OF THE VARIABLE
|
||||
. I $E(C0CN,1,5)="ACTOR" D SETFDA("SECTION","ACTORS") ;
|
||||
. I $E(C0CN,1,6)="SOCIAL" D ;
|
||||
. . D SETFDA("SECTION","SOCIAL HISTORY") ;
|
||||
. . D SETFDA("STATUS","X") ;SOCIAL HISTORY NOT IMPLEMENTED
|
||||
. . S C0CSTAT=1
|
||||
. I $E(C0CN,1,6)="FAMILY" D ;
|
||||
. . D SETFDA("SECTION","FAMILY HISTORY") ;
|
||||
. . D SETFDA("STATUS","X") ;FAMILY HISTORY NOT IMPLEMENTED
|
||||
. . S C0CSTAT=1
|
||||
. I $E(C0CN,1,5)="ALERT" D SETFDA("SECTION","ALERTS")
|
||||
. I $E(C0CN,1,5)="VITAL" D SETFDA("SECTION","VIT")
|
||||
. I $E(C0CN,1,7)="PROBLEM" D SETFDA("SECTION","PROBLEMS")
|
||||
. I $E(C0CN,1,10)="RESULTTEST" D SETFDA("SECTION","TEST")
|
||||
. E I $E(C0CN,1,6)="RESULT" D SETFDA("SECTION","LABS")
|
||||
. I C0CN["CODEVALUE" D SETFDA("TYPE","CD") ;CODES
|
||||
. I C0CN["CODEVERSION" D SETFDA("TYPE","CV") ; CODE VERSION
|
||||
. I C0CN["CODINGSYSTEM" D SETFDA("TYPE","CS") ;CODING SYSTEM
|
||||
. I $$ZVALUE("STATUS")=""!'C0CSTAT D SETFDA("STATUS","N") ;BLANK STATUS TO N
|
||||
. I $$ZVALUE("XPATH")["/Medication/Directions/" D ; MEDS DIRECTIONS VAR
|
||||
. . D SETFDA("SECTION","DIRECTIONS") ; SPECIAL SECTION FOR DIRECTIONS
|
||||
. E I $$ZVALUE("XPATH")["/Medications/Medication/" D ; ALL OTHER MEDS
|
||||
. . D SETFDA("SECTION","MEDS") ; A MEDS VAR
|
||||
. I $E(C0CN,($L(C0CN)-1),$L(C0CN))="ID" D SETFDA("TYPE","ID") ;CATCH THE IDS
|
||||
. I C0CN["DATETIME" D SETFDA("TYPE","DT") ; DATE/TIME VARIABLE
|
||||
. W "VARIABLE: ",C0CZX," ",C0CA("VARIABLE"),!
|
||||
. ;ZWR C0CFDA
|
||||
. I $D(C0CFDA) D ; WE HAVE CHANGES ON THIS VARIABLE
|
||||
. . ZWR C0CFDA
|
||||
. . D UPDATE^DIE("","C0CFDA(C0CZX)")
|
||||
. . I $D(^TMP("DIERR",$J)) U $P BREAK
|
||||
; ZWR C0CFDA
|
||||
Q
|
||||
;
|
||||
SETFDA(C0CSN,C0CSV) ; INTERNAL ROUTINE TO MAKE AN FDA ENTRY FOR FIELD C0CSN
|
||||
; TO SET TO VALUE C0CSV.
|
||||
; C0CFDA,C0CA,C0CZX ARE ASSUMED FROM THE CALLING ROUTINE
|
||||
; C0CSN,C0CSV ARE PASSED BY VALUE
|
||||
;
|
||||
N C0CSI,C0CSJ
|
||||
S C0CSI=$$ZFILE(C0CSN) ; FILE NUMBER
|
||||
S C0CSJ=$$ZFIELD(C0CSN) ; FIELD NUMBER
|
||||
S C0CFDA(C0CZX,C0CSI,C0CZX_",",C0CSJ)=C0CSV
|
||||
Q
|
||||
ZFILE(ZFN) ; INTERNAL EXTRINSIC TO RETURN FILE NUMBER FOR FIELD NAME PASSED
|
||||
; BY VALUE IN ZFN. FILE NUMBER IS PIECE 1 OF C0CA(ZFN)
|
||||
Q $P(C0CA(ZFN),"^",1)
|
||||
ZFIELD(ZFN) ;INTERNAL EXTRINSIC TO RETURN FIELD NUMBER FOR FIELD NAME PASSED
|
||||
; BY VALUE IN ZFN. FILE NUMBER IS PIECE 2 OF C0CA(ZFN)
|
||||
Q $P(C0CA(ZFN),"^",2)
|
||||
ZVALUE(ZFN) ;INTERNAL EXTRINSIC TO RETURN VALUE FOR FIELD NAME PASSED
|
||||
; BY VALUE IN ZFN. FILE NUMBER IS PIECE 3 OF C0CA(ZFN)
|
||||
Q $P(C0CA(ZFN),"^",3)
|
||||
;
|
Loading…
Reference in New Issue