RORDD01 ;HCIOFO/SG - DATA DICTIONARY UTILITIES ; 6/14/06 2:07pm ;;1.5;CLINICAL CASE REGISTRIES;**1**;Feb 17, 2006;Build 24 ; Q ; ;***** "AIDSOI" TRIGGER OF THE "AIDS INDICATOR DISEASE" MULTIPLE ; ; .SDA Reference to a local array of record IENs ; ; DATE Date of an AIDS indicator disease ; AIDSOI(SDA,DATE) ; N IENS,TMP,RORFDA,RORMSG ;--- Do not do anything if the CLINICAL AIDS field is already set S IENS=+$G(SDA(1)) Q:IENS'>0 S IENS=IENS_"," Q:$$GET1^DIQ(799.4,IENS,.02,"I",,"RORMSG") ;--- S DATE=$P(DATE,".") I DATE>0 D . S:'$E(DATE,4,5) $E(DATE,4,5)="01" . S:'$E(DATE,6,7) $E(DATE,6,7)="01" E S DATE=$$DT^XLFDT ;--- S RORFDA(799.4,IENS,.02)=1 S RORFDA(799.4,IENS,.03)=DATE D FILE^DIE(,"RORFDA","RORMSG") Q ; ;***** "ANC" INDEX OF THE "REGISTRY NAME" MULTIPLE OF THE FILE #799.6 ; ; .SDA Reference to a local array of record IENs ; ; REGNAME Registry name ; ; MODE 1 - Set, 0 - Kill ; ANC7996(SDA,REGNAME,MODE) ; I MODE S MODE=($D(^RORDATA(799.6,SDA(1),3,"ANC"))>1) D . S ^RORDATA(799.6,SDA(1),3,"ANC",$E(REGNAME,1,30),SDA)="" E D S MODE=($D(^RORDATA(799.6,SDA(1),3,"ANC"))>1) . K ^RORDATA(799.6,SDA(1),3,"ANC",$E(REGNAME,1,30),SDA) Q:MODE ;--- Re-index the main record (the "ADNAUTO" index, in particular) N DA,DIK S DIK="^RORDATA(799.6,",DIK(1)=".01",DA=SDA(1) D EN^DIK Q ; ;***** DELETES THE DATA ASSOCIATED WITH THE MAIN REGISTRY RECORD ; ; IEN IEN of the registry record (file #798) ; PTIEN Patient IEN ; DEL798(IEN,PTIEN) ; N DA,DIK,I,PTDEL ;--- Delete the HIV record from the ROR HIV RECORD file (#799.4) I $D(^RORDATA(799.4,IEN)) S DIK="^RORDATA(799.4,",DA=IEN D ^DIK ;--- Check if the patient is added to more than one registry S I="",PTDEL=1 F S I=$O(^RORDATA(798,"B",PTIEN,I)) Q:I="" S:I'=IEN PTDEL=0 ;--- Delete corresponding patient's records if they are not ; referenced by other registries and the patient's record ;--- in the PATIENT file (#2) is not a "merged" one. I PTDEL D:$G(^DPT(PTIEN,-9))'>0 . ;--- Delete the record from the ROR PATIENT file . S DIK="^RORDATA(798.4,",DA=PTIEN D ^DIK . ;--- Delete the record from the ROR PATIENT EVENTS file . S DIK="^RORDATA(798.3,",DA=PTIEN D ^DIK Q ; ;***** RETURNS THE VALUE OF 'DATE SELECTED' COMPUTED FIELD ; ; IEN IEN of the registry record (file #798) ; DTSEL(IEN) ; N DTSEL ;--- Earliest date of a selection rule S DTSEL=$O(^RORDATA(798,IEN,1,"AD",""))\1 ;--- If SELECTION RULE multiple is empty, return DATE ENTERED Q $S(DTSEL>0:DTSEL,1:$P($G(^RORDATA(798,IEN,0)),U,3)\1) ; ;***** STORE THE VALUE INTO THE FIELD ; ; FILE Sub(file) number ; IENS IENS of the record ; FIELD Field number ; VALUE Internal value to be assigned ; FILE(FILE,IENS,FIELD,VALUE) ; N ROR8FDA,ROR8MSG,TMP S TMP=$S($E(IENS,$L(IENS))=",":IENS,1:IENS_",") S ROR8FDA(+FILE,TMP,+FIELD)=VALUE D FILE^DIE(,"ROR8FDA","ROR8MSG") Q ; ;***** STATUS OF THE HISTORICAL DATA DEFINITION ; ; HDEIEN IEN of the HDE definition (file #799.6) ; ; Return Values: ; "" Unknown/Undefined ; 0 Inactive ; 1 Pending/Active ; 2 Completed ; HDESTAT(HDEIEN) ; N BUF,STATUS,TYPE S HDEIEN=+HDEIEN,BUF=$G(^RORDATA(799.6,HDEIEN,0)) S TYPE=+$P(BUF,U,2),STATUS="" ;=== Auto I TYPE=1 D Q STATUS . N ADT . ;--- Activation Date . S ADT=+$P(BUF,U,7) . I (ADT'>0)!(ADT