This update contains the completion of attempt 1 at extracting patient data from the patient file. It also contains a unit tester routine.

This commit is contained in:
sam 2008-06-27 03:23:21 +00:00
parent c473eb8bf4
commit 8ed7272548
2 changed files with 240 additions and 3 deletions

View File

@ -3,6 +3,72 @@ CCRDPT ;CCRCCD/SMH - Routines to Extract Patient Data for CCDCCR; 6/15/08
; NOTE TO PROGRAMMER: You need to call INIT(DPT) to initialize; and ; NOTE TO PROGRAMMER: You need to call INIT(DPT) to initialize; and
; DESTROY to clean-up. ; DESTROY to clean-up.
; CCRDPT 83 lines CCRCCD/SMH - Routines to Extract Patient Data for
; INIT 9 lines Copy DFN global to a local variable
; DESTROY 6 lines Kill local variable
; FAMILY 6 lines Family Name
; GIVEN 6 lines Given Name
; MIDDLE 6 lines Middle Name
; SUFFIX 6 lines Suffi Name
; DISPNAME 5 lines Display Name
; DOB 6 lines Date of Birth
; GENDER 4 lines Get Gender
; SSN 4 lines Get SSN for ID
; ADDRTYPE 4 lines Get Home Address
; ADDR1 4 lines Get Home Address line 1
; ADDR2 5 lines Get Home Address line 2
; CITY 4 lines Get City for Home Address
; STATE 11 lines Get State for Home Address
; ZIP 4 lines Get Zip code for Home Address
; COUNTY 4 lines Get County for our Address
; COUNTRY 4 lines Get Country for our Address
; RESTEL 4 lines Residential Telephone
; WORKTEL 4 lines Work Telephone
; EMAIL 4 lines Email Adddress
; CELLTEL 4 lines Cell Phone
; NOK1FAM 6 lines Next of Kin 1 (NOK1) Family Name
; NOK1GIV 6 lines NOK1 Given Name
; NOK1MID 6 lines NOK1 Middle Name
; NOK1SUF 6 lines NOK1 Suffi Name
; NOK1DISP 5 lines NOK1 Display Name
; NOK1REL 4 lines NOK1 Relationship to the patient
; NOK1ADD1 4 lines NOK1 Address 1
; NOK1ADD2 5 lines NOK1 Address 2
; NOK1CITY 4 lines NOK1 City
; NOK1STAT 5 lines NOK1 State
; NOK1ZIP 4 lines NOK1 Zip Code
; NOK1HTEL; 4 lines NOK1 Home Telephone
; NOK1WTEL; 4 lines NOK1 Work Telephone
; NOK1SAME; 4 lines Is NOK1's Address the same the patient?
; NOK2FAM 6 lines NOK2 Family Name
; NOK2GIV 6 lines NOK2 Given Name
; NOK2MID 6 lines NOK2 Middle Name
; NOK2SUF 5 lines NOK2 Suffi Name
; NOK2DISP 5 lines NOK2 Display Name
; NOK2REL 4 lines NOK2 Relationship to the patient
; NOK2ADD1 4 lines NOK2 Address 1
; NOK2ADD2 5 lines NOK2 Address 2
; NOK2CITY 4 lines NOK2 City
; NOK2STAT 5 lines NOK2 State
; NOK2ZIP 4 lines NOK2 Zip Code
; NOK2HTEL; 4 lines NOK2 Home Telephone
; NOK2WTEL; 4 lines NOK2 Work Telephone
; NOK2SAME; 4 lines Is NOK2's Address the same the patient?
; EMERFAM 6 lines Emergency Contact (EMER) Family Name
; EMERGIV 6 lines EMER Given Name
; EMERMID 6 lines EMER Middle Name
; EMERSUF 5 lines EMER Suffi Name
; EMERDISP 5 lines EMER Display Name
; EMERREL 4 lines EMER Relationship to the patient
; EMERADD1 4 lines EMER Address 1
; EMERADD2 5 lines EMER Address 2
; EMERCITY 4 lines EMER City
; EMERSTAT 5 lines EMER State
; EMERZIP 4 lines EMER Zip Code
; EMERHTEL; 4 lines EMER Home Telephone
; EMERWTEL; 4 lines EMER Work Telephone
; EMERSAME; 4 lines Is EMER's Address the same the NOK?
W "No Entry at top!" Q W "No Entry at top!" Q
@ -139,7 +205,7 @@ SSN() ; Get SSN for ID; PUBLIC; Extrinsic
; PREREQ: PT Defined ; PREREQ: PT Defined
Q $P(PT(0),"^",9) Q $P(PT(0),"^",9)
; ;
ADDRTYPE(ADDR) ; Get Home Address; PUBLIC; Extrinsic ADDRTYPE() ; Get Home Address; PUBLIC; Extrinsic
; Vista only stores a home address for the patient. ; Vista only stores a home address for the patient.
Q "Home" Q "Home"
; ;
@ -224,6 +290,44 @@ NOK1DISP() ; NOK1 Display Name; PUBLIC; Extrinsic
N NAME S NAME=$P(PT(.21),"^",1) N NAME S NAME=$P(PT(.21),"^",1)
Q $$NAMEFMT^XLFNAME(.NAME,"G","MXc") Q $$NAMEFMT^XLFNAME(.NAME,"G","MXc")
; "G" is Given Name First; "MXc" is Mixed Case, With Suffx Preceded by Comma ; "G" is Given Name First; "MXc" is Mixed Case, With Suffx Preceded by Comma
NOK1REL() ; NOK1 Relationship to the patient; PUBLIC; Extrinsic
; PREREQ: PT Defined
Q $P(PT(.21),"^",2)
;
NOK1ADD1() ; NOK1 Address 1; PUBLIC; Extrinsic
; PREREQ: PT Defined
Q $P(PT(.21),"^",3)
;
NOK1ADD2() ; NOK1 Address 2; PUBLIC; Extrinsic
; PREREQ: PT Defined
; As before, CCR only allows two fileds for the address, so we have to compromise
Q $P(PT(.21),"^",4)_", "_$P(PT(.21),"^",5)
;
NOK1CITY() ; NOK1 City; PUBLIC; Extrinsic
; PREREQ: PT Defined
Q $P(PT(.21),"^",6)
;
NOK1STAT() ; NOK1 State; PUBLIC; Extrinsic
; PREREQ: PT Defined
N STATENUM S STATENUM=$P(PT(.21),"^",7)
Q $P(^DIC(5,STATENUM,0),"^",1)
;
NOK1ZIP() ; NOK1 Zip Code; PUBLIC; Extrinsic
; PREREQ: PT Defined
Q $P(PT(.21),"^",8)
;
NOK1HTEL() ; NOK1 Home Telephone; PUBLIC; Extrinsic
; PREREQ: PT Defined
Q $P(PT(.21),"^",9)
;
NOK1WTEL() ; NOK1 Work Telephone; PUBLIC; Extrinsic
; PREREQ: PT Defined
Q $P(PT(.21),"^",11)
;
NOK1SAME() ; Is NOK1's Address the same the patient?; PUBLIC; Extrinsic
; PREREQ: PT Defined
Q $P(PT(.21),"^",10)
;
NOK2FAM() ; NOK2 Family Name; PUBLIC; Extrinsic NOK2FAM() ; NOK2 Family Name; PUBLIC; Extrinsic
; PREREQ: PT Defined ; PREREQ: PT Defined
N NAME S NAME=$P(PT(.211),"^",1) N NAME S NAME=$P(PT(.211),"^",1)
@ -247,10 +351,112 @@ NOK2SUF() ; NOK2 Suffi Name; PUBLIC; Extrinsic
N NAME S NAME=$P(PT(.211),"^",1) N NAME S NAME=$P(PT(.211),"^",1)
D NAMECOMP^XLFNAME(.NAME) D NAMECOMP^XLFNAME(.NAME)
Q NAME("SUFFIX") Q NAME("SUFFIX")
;
NOK2DISP() ; NOK2 Display Name; PUBLIC; Extrinsic NOK2DISP() ; NOK2 Display Name; PUBLIC; Extrinsic
; PREREQ: PT Defined ; PREREQ: PT Defined
N NAME S NAME=$P(PT(.211),"^",1) N NAME S NAME=$P(PT(.211),"^",1)
Q $$NAMEFMT^XLFNAME(.NAME,"G","MXc") Q $$NAMEFMT^XLFNAME(.NAME,"G","MXc")
; "G" is Given Name First; "MXc" is Mixed Case, With Suffx Preceded by Comma ; "G" is Given Name First; "MXc" is Mixed Case, With Suffx Preceded by Comma
NOK2REL() ; NOK2 Relationship to the patient; PUBLIC; Extrinsic
; PREREQ: PT Defined
Q $P(PT(.211),"^",2)
;
NOK2ADD1() ; NOK2 Address 1; PUBLIC; Extrinsic
; PREREQ: PT Defined
Q $P(PT(.211),"^",3)
;
NOK2ADD2() ; NOK2 Address 2; PUBLIC; Extrinsic
; PREREQ: PT Defined
; As before, CCR only allows two fileds for the address, so we have to compromise
Q $P(PT(.211),"^",4)_", "_$P(PT(.211),"^",5)
;
NOK2CITY() ; NOK2 City; PUBLIC; Extrinsic
; PREREQ: PT Defined
Q $P(PT(.211),"^",6)
;
NOK2STAT() ; NOK2 State; PUBLIC; Extrinsic
; PREREQ: PT Defined
N STATENUM S STATENUM=$P(PT(.211),"^",7)
Q $P(^DIC(5,STATENUM,0),"^",1) ; Explained above
;
NOK2ZIP() ; NOK2 Zip Code; PUBLIC; Extrinsic
; PREREQ: PT Defined
Q $P(PT(.211),"^",8)
;
NOK2HTEL() ; NOK2 Home Telephone; PUBLIC; Extrinsic
; PREREQ: PT Defined
Q $P(PT(.211),"^",9)
;
NOK2WTEL() ; NOK2 Work Telephone; PUBLIC; Extrinsic
; PREREQ: PT Defined
Q $P(PT(.211),"^",11)
;
NOK2SAME() ; Is NOK2's Address the same the patient?; PUBLIC; Extrinsic
; PREREQ: PT Defined
Q $P(PT(.211),"^",10)
;
EMERFAM() ; Emergency Contact (EMER) Family Name; PUBLIC; Extrinsic
; PREREQ: PT Defined
N NAME S NAME=$P(PT(.33),"^",1)
D NAMECOMP^XLFNAME(.NAME)
Q NAME("FAMILY")
;
EMERGIV() ; EMER Given Name; PUBLIC; Extrinsic
; PREREQ: PT Defined
N NAME S NAME=$P(PT(.33),"^",1)
D NAMECOMP^XLFNAME(.NAME)
Q NAME("GIVEN")
;
EMERMID() ; EMER Middle Name; PUBLIC; Extrinsic
; PREREQ: PT Defined
N NAME S NAME=$P(PT(.33),"^",1)
D NAMECOMP^XLFNAME(.NAME)
Q NAME("MIDDLE")
;
EMERSUF() ; EMER Suffi Name; PUBLIC; Extrinsic
; PREREQ: PT Defined
N NAME S NAME=$P(PT(.33),"^",1)
D NAMECOMP^XLFNAME(.NAME)
Q NAME("SUFFIX")
EMERDISP() ; EMER Display Name; PUBLIC; Extrinsic
; PREREQ: PT Defined
N NAME S NAME=$P(PT(.33),"^",1)
Q $$NAMEFMT^XLFNAME(.NAME,"G","MXc")
; "G" is Given Name First; "MXc" is Mixed Case, With Suffx Preceded by Comma
EMERREL() ; EMER Relationship to the patient; PUBLIC; Extrinsic
; PREREQ: PT Defined
Q $P(PT(.33),"^",2)
;
EMERADD1() ; EMER Address 1; PUBLIC; Extrinsic
; PREREQ: PT Defined
Q $P(PT(.33),"^",3)
;
EMERADD2() ; EMER Address 2; PUBLIC; Extrinsic
; PREREQ: PT Defined
; As before, CCR only allows two fileds for the address, so we have to compromise
Q $P(PT(.33),"^",4)_", "_$P(PT(.33),"^",5)
;
EMERCITY() ; EMER City; PUBLIC; Extrinsic
; PREREQ: PT Defined
Q $P(PT(.33),"^",6)
;
EMERSTAT() ; EMER State; PUBLIC; Extrinsic
; PREREQ: PT Defined
N STATENUM S STATENUM=$P(PT(.33),"^",7)
Q $P(^DIC(5,STATENUM,0),"^",1) ; Explained above
;
EMERZIP() ; EMER Zip Code; PUBLIC; Extrinsic
; PREREQ: PT Defined
Q $P(PT(.33),"^",8)
;
EMERHTEL() ; EMER Home Telephone; PUBLIC; Extrinsic
; PREREQ: PT Defined
Q $P(PT(.33),"^",9)
;
EMERWTEL() ; EMER Work Telephone; PUBLIC; Extrinsic
; PREREQ: PT Defined
Q $P(PT(.33),"^",11)
;
EMERSAME() ; Is EMER's Address the same the NOK?; PUBLIC; Extrinsic
; PREREQ: PT Defined
Q $P(PT(.33),"^",10)
;

31
p/CCRDPTT.m Normal file
View File

@ -0,0 +1,31 @@
CCRDPTT; Unit Tester...
; Get the functions in the routine using Rick's routine
; STATS(0)="CCRDPT^3080626.190908^396^14094^6414499860"
; STATS(1,0)="CCRDPT ;CCRCCD/SMH - Routines to Extract Patient Data for CCDCCR; 6/15/08"
; STATS(2,0)=" ;;0.1;CCRCCD;;Jun 15, 2008;"
; STATS(84,0)="INIT(DFN) ; Copy DFN global to a local variable; PUBLIC"
; STATS(93,0)="DESTROY ; Kill local variable; PUBLIC"
; STATS(99,0)="FAMILY() ; Family Name; PUBLIC; Extrinsic"
; STATS(105,0)="GIVEN() ; Given Name; PUBLIC; Extrinsic"
; STATS(111,0)="MIDDLE() ; Middle Name; PUBLIC; Extrinsic "
; etc.
; Load Routine Entry points; We get a sweeeeeet array
N OUT
D ANALYZE^ARJTXRD("CCRDPT",.OUT) ; Analyze a routine in the directory
ZWR OUT(,0)
N X,Y
; Select Patient
S DIC=2,DIC(0)="AEMQ" D ^DIC
W "You have selected patient "_Y,!!
D INIT^CCRDPT($P(Y,"^"))
ZWR PT
N I S I=160 F S I=$O(OUT(I)) Q:I="" D
. W "OUT("_I_",0)"_" is "_$P(OUT(I,0)," ")_" "
. W "valued at "
. W @("$$"_$P(OUT(I,0),"()")_"^"_"CCRDPT"_"()")
. W !
Q