KIDS Distribution saved on Sep 10, 2021@18:52:20
Test Release SAMI*18.0*14 SEQ #14 T2 (sami-18-14-t2)
**KIDS**:SAMI*18.0*14^

**INSTALL NAME**
SAMI*18.0*14
"BLD",11514,0)
SAMI*18.0*14^^0^3210910^n
"BLD",11514,1,0)
^^1^1^3210910^^
"BLD",11514,1,1,0)
Test Release SAMI*18.0*14 SEQ #14 T2 (18-14-t2)
"BLD",11514,4,0)
^9.64PA^^
"BLD",11514,6.3)
4
"BLD",11514,"INID")
^n
"BLD",11514,"INIT")
POS1814^SAMIPAT
"BLD",11514,"KRN",0)
^9.67PA^1.5^25
"BLD",11514,"KRN",.4,0)
.4
"BLD",11514,"KRN",.401,0)
.401
"BLD",11514,"KRN",.402,0)
.402
"BLD",11514,"KRN",.403,0)
.403
"BLD",11514,"KRN",.5,0)
.5
"BLD",11514,"KRN",.84,0)
.84
"BLD",11514,"KRN",1.5,0)
1.5
"BLD",11514,"KRN",1.6,0)
1.6
"BLD",11514,"KRN",1.61,0)
1.61
"BLD",11514,"KRN",1.62,0)
1.62
"BLD",11514,"KRN",3.6,0)
3.6
"BLD",11514,"KRN",3.8,0)
3.8
"BLD",11514,"KRN",9.2,0)
9.2
"BLD",11514,"KRN",9.8,0)
9.8
"BLD",11514,"KRN",9.8,"NM",0)
^9.68A^4^4
"BLD",11514,"KRN",9.8,"NM",1,0)
SAMIUR^^0^B608610712
"BLD",11514,"KRN",9.8,"NM",2,0)
SAMIUR2^^0^B1328996822
"BLD",11514,"KRN",9.8,"NM",3,0)
SAMIURUL^^0^B102189
"BLD",11514,"KRN",9.8,"NM",4,0)
SAMIPAT^^0^B9183353
"BLD",11514,"KRN",9.8,"NM","B","SAMIPAT",4)

"BLD",11514,"KRN",9.8,"NM","B","SAMIUR",1)

"BLD",11514,"KRN",9.8,"NM","B","SAMIUR2",2)

"BLD",11514,"KRN",9.8,"NM","B","SAMIURUL",3)

"BLD",11514,"KRN",19,0)
19
"BLD",11514,"KRN",19.1,0)
19.1
"BLD",11514,"KRN",101,0)
101
"BLD",11514,"KRN",409.61,0)
409.61
"BLD",11514,"KRN",771,0)
771
"BLD",11514,"KRN",779.2,0)
779.2
"BLD",11514,"KRN",870,0)
870
"BLD",11514,"KRN",8989.51,0)
8989.51
"BLD",11514,"KRN",8989.52,0)
8989.52
"BLD",11514,"KRN",8993,0)
8993
"BLD",11514,"KRN",8994,0)
8994
"BLD",11514,"KRN","B",.4,.4)

"BLD",11514,"KRN","B",.401,.401)

"BLD",11514,"KRN","B",.402,.402)

"BLD",11514,"KRN","B",.403,.403)

"BLD",11514,"KRN","B",.5,.5)

"BLD",11514,"KRN","B",.84,.84)

"BLD",11514,"KRN","B",1.5,1.5)

"BLD",11514,"KRN","B",1.6,1.6)

"BLD",11514,"KRN","B",1.61,1.61)

"BLD",11514,"KRN","B",1.62,1.62)

"BLD",11514,"KRN","B",3.6,3.6)

"BLD",11514,"KRN","B",3.8,3.8)

"BLD",11514,"KRN","B",9.2,9.2)

"BLD",11514,"KRN","B",9.8,9.8)

"BLD",11514,"KRN","B",19,19)

"BLD",11514,"KRN","B",19.1,19.1)

"BLD",11514,"KRN","B",101,101)

"BLD",11514,"KRN","B",409.61,409.61)

"BLD",11514,"KRN","B",771,771)

"BLD",11514,"KRN","B",779.2,779.2)

"BLD",11514,"KRN","B",870,870)

"BLD",11514,"KRN","B",8989.51,8989.51)

"BLD",11514,"KRN","B",8989.52,8989.52)

"BLD",11514,"KRN","B",8993,8993)

"BLD",11514,"KRN","B",8994,8994)

"BLD",11514,"QUES",0)
^9.62^^
"BLD",11514,"REQB",0)
^9.611^12^12
"BLD",11514,"REQB",1,0)
SAMI*18.0*1^0
"BLD",11514,"REQB",2,0)
SAMI*18.0*2^0
"BLD",11514,"REQB",3,0)
SAMI*18.0*3^0
"BLD",11514,"REQB",4,0)
SAMI*18.0*4^0
"BLD",11514,"REQB",5,0)
SAMI 18.0T05^0
"BLD",11514,"REQB",6,0)
SAMI*18.0*6^0
"BLD",11514,"REQB",7,0)
SAMI*18.0*8^0
"BLD",11514,"REQB",8,0)
SAMI*18.0*9^0
"BLD",11514,"REQB",9,0)
SAMI*18.0*10^0
"BLD",11514,"REQB",10,0)
SAMI*18.0*11^0
"BLD",11514,"REQB",11,0)
SAMI*18.0*12^0
"BLD",11514,"REQB",12,0)
SAMI*18.0*13^0
"BLD",11514,"REQB","B","SAMI 18.0T05",5)

"BLD",11514,"REQB","B","SAMI*18.0*1",1)

"BLD",11514,"REQB","B","SAMI*18.0*10",9)

"BLD",11514,"REQB","B","SAMI*18.0*11",10)

"BLD",11514,"REQB","B","SAMI*18.0*12",11)

"BLD",11514,"REQB","B","SAMI*18.0*13",12)

"BLD",11514,"REQB","B","SAMI*18.0*2",2)

"BLD",11514,"REQB","B","SAMI*18.0*3",3)

"BLD",11514,"REQB","B","SAMI*18.0*4",4)

"BLD",11514,"REQB","B","SAMI*18.0*6",6)

"BLD",11514,"REQB","B","SAMI*18.0*8",7)

"BLD",11514,"REQB","B","SAMI*18.0*9",8)

"INIT")
POS1814^SAMIPAT
"MBREQ")
0
"QUES","XPF1",0)
Y
"QUES","XPF1","??")
^D REP^XPDH
"QUES","XPF1","A")
Shall I write over your |FLAG| File
"QUES","XPF1","B")
YES
"QUES","XPF1","M")
D XPF1^XPDIQ
"QUES","XPF2",0)
Y
"QUES","XPF2","??")
^D DTA^XPDH
"QUES","XPF2","A")
Want my data |FLAG| yours
"QUES","XPF2","B")
YES
"QUES","XPF2","M")
D XPF2^XPDIQ
"QUES","XPI1",0)
YO
"QUES","XPI1","??")
^D INHIBIT^XPDH
"QUES","XPI1","A")
Want KIDS to INHIBIT LOGONs during the install
"QUES","XPI1","B")
NO
"QUES","XPI1","M")
D XPI1^XPDIQ
"QUES","XPM1",0)
PO^VA(200,:EM
"QUES","XPM1","??")
^D MG^XPDH
"QUES","XPM1","A")
Enter the Coordinator for Mail Group '|FLAG|'
"QUES","XPM1","B")

"QUES","XPM1","M")
D XPM1^XPDIQ
"QUES","XPO1",0)
Y
"QUES","XPO1","??")
^D MENU^XPDH
"QUES","XPO1","A")
Want KIDS to Rebuild Menu Trees Upon Completion of Install
"QUES","XPO1","B")
NO
"QUES","XPO1","M")
D XPO1^XPDIQ
"QUES","XPZ1",0)
Y
"QUES","XPZ1","??")
^D OPT^XPDH
"QUES","XPZ1","A")
Want to DISABLE Scheduled Options, Menu Options, and Protocols
"QUES","XPZ1","B")
NO
"QUES","XPZ1","M")
D XPZ1^XPDIQ
"QUES","XPZ2",0)
Y
"QUES","XPZ2","??")
^D RTN^XPDH
"QUES","XPZ2","A")
Want to MOVE routines to other CPUs
"QUES","XPZ2","B")
NO
"QUES","XPZ2","M")
D XPZ2^XPDIQ
"RTN")
4
"RTN","SAMIPAT")
0^4^B9183353
"RTN","SAMIPAT",1,0)
SAMIPAT ;ven/toad - init subroutines ;2021-09-10t01:30z
"RTN","SAMIPAT",2,0)
 ;;18.0;SAMI;**12,14**;2020-01;Build 4
"RTN","SAMIPAT",3,0)
 ;;18.14
"RTN","SAMIPAT",4,0)
 ;
"RTN","SAMIPAT",5,0)
 ; Routine SAMIPAT contains VAPALS-ELCAP initialization subroutines
"RTN","SAMIPAT",6,0)
 ; to use as KIDS pre- & post-installs & environment checks.
"RTN","SAMIPAT",7,0)
 ;
"RTN","SAMIPAT",8,0)
 quit  ; no entry from top
"RTN","SAMIPAT",9,0)
 ;
"RTN","SAMIPAT",10,0)
 ;
"RTN","SAMIPAT",11,0)
 ;
"RTN","SAMIPAT",12,0)
 ;@section 0 primary development
"RTN","SAMIPAT",13,0)
 ;
"RTN","SAMIPAT",14,0)
 ;
"RTN","SAMIPAT",15,0)
 ;
"RTN","SAMIPAT",16,0)
 ;@routine-credits
"RTN","SAMIPAT",17,0)
 ;@dev-main Frederick D. S. Marshall (toad)
"RTN","SAMIPAT",18,0)
 ; toad@vistaexpertise.net
"RTN","SAMIPAT",19,0)
 ;@dev-org-main Vista Expertise Network (ven)
"RTN","SAMIPAT",20,0)
 ; http://vistaexpertise.net
"RTN","SAMIPAT",21,0)
 ;@copyright 2021, toad, all rights reserved
"RTN","SAMIPAT",22,0)
 ;@license see routine SAMIUL
"RTN","SAMIPAT",23,0)
 ;
"RTN","SAMIPAT",24,0)
 ;@last-update 2021-09-10t01:39z
"RTN","SAMIPAT",25,0)
 ;@application Screening Applications Management (SAM)
"RTN","SAMIPAT",26,0)
 ;@module Screening Applications Management - IELCAP (SAMI)
"RTN","SAMIPAT",27,0)
 ;@suite-of-files SAMI Forms (311.101-311.199)
"RTN","SAMIPAT",28,0)
 ;@version 18.14
"RTN","SAMIPAT",29,0)
 ;@release-date 2020-01
"RTN","SAMIPAT",30,0)
 ;@patch-list **12,14**
"RTN","SAMIPAT",31,0)
 ;
"RTN","SAMIPAT",32,0)
 ;@dev-add Kenneth W. McGlothlen (mcglk)
"RTN","SAMIPAT",33,0)
 ; mcglk@vistaexpertise.net
"RTN","SAMIPAT",34,0)
 ;@dev-add George P. Lilly (gpl)
"RTN","SAMIPAT",35,0)
 ; gpl@vistaexpertise.net
"RTN","SAMIPAT",36,0)
 ;@dev-add Linda M. R. Yaw (lmry)
"RTN","SAMIPAT",37,0)
 ; lmry@vistaexpertise.net
"RTN","SAMIPAT",38,0)
 ;
"RTN","SAMIPAT",39,0)
 ;@routine-log repo github.com:VA-PALS-ELCAP/SAMI-VAPALS-ELCAP.git
"RTN","SAMIPAT",40,0)
 ; 2021-07-01 ven/mcglk&toad 18.12-t2 cbf7e46b
"RTN","SAMIPAT",41,0)
 ;  SAMIPAT new routine, new POS1812 post-install for patch 12.
"RTN","SAMIPAT",42,0)
 ;
"RTN","SAMIPAT",43,0)
 ; 2021-07-22/23 ven/toad 18.12  
"RTN","SAMIPAT",44,0)
 ;  SAMIPAT add PRE1812 pre-install.
"RTN","SAMIPAT",45,0)
 ;
"RTN","SAMIPAT",46,0)
 ; 2021-08-11 ven/mcglk&toad 18.12  b16cd38f
"RTN","SAMIPAT",47,0)
 ;  SAMIPAT rip out PRE1812.
"RTN","SAMIPAT",48,0)
 ;
"RTN","SAMIPAT",49,0)
 ; 2021-09-08 ven/lmry 18.14  2af1f2e7
"RTN","SAMIPAT",50,0)
 ;  SAMIPAT add post-install for patch SAMI*1.18*14
"RTN","SAMIPAT",51,0)
 ;
"RTN","SAMIPAT",52,0)
 ;@contents
"RTN","SAMIPAT",53,0)
 ; POS1812 kids post-install for sami 18.12
"RTN","SAMIPAT",54,0)
 ; POS1814 kids post-install for sami 18.14
"RTN","SAMIPAT",55,0)
 ;
"RTN","SAMIPAT",56,0)
 ;@section 1 subroutines for SAMI 18.12
"RTN","SAMIPAT",57,0)
 ;
"RTN","SAMIPAT",58,0)
 ;
"RTN","SAMIPAT",59,0)
 ;
"RTN","SAMIPAT",60,0)
 ;@kids-post POST1812^SAMIPAT
"RTN","SAMIPAT",61,0)
POS1812 ; kids post-install for sami 18.12
"RTN","SAMIPAT",62,0)
 ;
"RTN","SAMIPAT",63,0)
 do ADDSVC^SAMIPARM ; install get params web service
"RTN","SAMIPAT",64,0)
 ;
"RTN","SAMIPAT",65,0)
 ; in honor of Tchaikovsky's overture: boom
"RTN","SAMIPAT",66,0)
 ;
"RTN","SAMIPAT",67,0)
 quit  ; end of kids-post POS1812^SAMIPAT
"RTN","SAMIPAT",68,0)
 ;
"RTN","SAMIPAT",69,0)
 ;
"RTN","SAMIPAT",70,0)
 ;
"RTN","SAMIPAT",71,0)
 ;@section 2 subroutines for SAMI 18.14
"RTN","SAMIPAT",72,0)
 ;
"RTN","SAMIPAT",73,0)
 ;
"RTN","SAMIPAT",74,0)
 ;
"RTN","SAMIPAT",75,0)
 ;@kids-post POST1814^SAMIPAT
"RTN","SAMIPAT",76,0)
POS1814 ; kids post-install for sami 18.14
"RTN","SAMIPAT",77,0)
 ;
"RTN","SAMIPAT",78,0)
 set SAMIDIR="/home/osehra/lib/silver/a-sami-vapals-elcap--vo-osehra-github/docs/form-fields/"
"RTN","SAMIPAT",79,0)
 do PRSTSV^SAMIFF(SAMIDIR,"background.tsv","form fields - background")
"RTN","SAMIPAT",80,0)
 do PRSTSV^SAMIFF(SAMIDIR,"biopsy.tsv","form fields - biopsy")
"RTN","SAMIPAT",81,0)
 do PRSTSV^SAMIFF(SAMIDIR,"ct-evaluation.tsv","form fields - ct evaluation")
"RTN","SAMIPAT",82,0)
 do PRSTSV^SAMIFF(SAMIDIR,"follow-up.tsv","form fields - follow up")
"RTN","SAMIPAT",83,0)
 do PRSTSV^SAMIFF(SAMIDIR,"intake.tsv","form fields - intake")
"RTN","SAMIPAT",84,0)
 do PRSTSV^SAMIFF(SAMIDIR,"intervention.tsv","form fields - intervention")
"RTN","SAMIPAT",85,0)
 do PRSTSV^SAMIFF(SAMIDIR,"pet-evaluation.tsv","form fields - pet evaluation")
"RTN","SAMIPAT",86,0)
 do PRSTSV^SAMIFF(SAMIDIR,"register.tsv","form fields - register")
"RTN","SAMIPAT",87,0)
 ; do DODD^SAMIADMN ; to import tsv files to generate DD graphs
"RTN","SAMIPAT",88,0)
 do CLRWEB^SAMIADMN ; Clear the M Web Server files cache
"RTN","SAMIPAT",89,0)
 do INIT2GPH^SAMICTD2 ; initialize CTEVAL dictionary into graph cteval-dict
"RTN","SAMIPAT",90,0)
 ;
"RTN","SAMIPAT",91,0)
 quit  ; end of kids-post POS1814^SAMIPAT
"RTN","SAMIPAT",92,0)
 ;
"RTN","SAMIPAT",93,0)
 ;
"RTN","SAMIPAT",94,0)
 ;
"RTN","SAMIPAT",95,0)
 ;@section 3 subroutines for future versions...
"RTN","SAMIPAT",96,0)
 ;
"RTN","SAMIPAT",97,0)
 ;
"RTN","SAMIPAT",98,0)
 ;
"RTN","SAMIPAT",99,0)
EOR ; end of routine SAMIPAT
"RTN","SAMIUR")
0^1^B608610712
"RTN","SAMIUR",1,0)
SAMIUR ;ven/gpl - user reports ;2021-09-10t01:37z
"RTN","SAMIUR",2,0)
 ;;18.0;SAMI;**5,10,11,12,14**;2020-01;Build 4
"RTN","SAMIUR",3,0)
 ;;18.14
"RTN","SAMIUR",4,0)
 ;
"RTN","SAMIUR",5,0)
 ; SAMIUR contains a web service & associated subroutines to produce
"RTN","SAMIUR",6,0)
 ; VAPALS-ELCAP user reports.
"RTN","SAMIUR",7,0)
 ;
"RTN","SAMIUR",8,0)
 quit  ; no entry from top
"RTN","SAMIUR",9,0)
 ;
"RTN","SAMIUR",10,0)
 ;
"RTN","SAMIUR",11,0)
 ;
"RTN","SAMIUR",12,0)
 ;@section 0 primary development
"RTN","SAMIUR",13,0)
 ;
"RTN","SAMIUR",14,0)
 ;
"RTN","SAMIUR",15,0)
 ;
"RTN","SAMIUR",16,0)
 ;@routine-credits
"RTN","SAMIUR",17,0)
 ;@dev-main George P. Lilly (gpl)
"RTN","SAMIUR",18,0)
 ; gpl@vistaexpertise.net
"RTN","SAMIUR",19,0)
 ;@dev-org-main Vista Expertise Network (ven)
"RTN","SAMIUR",20,0)
 ; http://vistaexpertise.net
"RTN","SAMIUR",21,0)
 ;@copyright 2017/2021, gpl, all rights reserved
"RTN","SAMIUR",22,0)
 ;@license see routine SAMIUL
"RTN","SAMIUR",23,0)
 ;
"RTN","SAMIUR",24,0)
 ;@last-update 2021-09-10t01:39z
"RTN","SAMIUR",25,0)
 ;@application Screening Applications Management (SAM)
"RTN","SAMIUR",26,0)
 ;@module Screening Applications Management - IELCAP (SAMI)
"RTN","SAMIUR",27,0)
 ;@suite-of-files SAMI Forms (311.101-311.199)
"RTN","SAMIUR",28,0)
 ;@version 18.12
"RTN","SAMIUR",29,0)
 ;@release-date 2020-01
"RTN","SAMIUR",30,0)
 ;@patch-list **5,10,11,12,14**
"RTN","SAMIUR",31,0)
 ;
"RTN","SAMIUR",32,0)
 ;@dev-add Frederick D. S. Marshall (toad)
"RTN","SAMIUR",33,0)
 ; toad@vistaexpertise.net
"RTN","SAMIUR",34,0)
 ;@dev-add Larry G. Carlson (lgc)
"RTN","SAMIUR",35,0)
 ; larry.g.carlson@gmail.com
"RTN","SAMIUR",36,0)
 ;@dev-add Alexis R. Carlson (arc)
"RTN","SAMIUR",37,0)
 ; whatisthehumanspirit@gmail.com
"RTN","SAMIUR",38,0)
 ;@dev-add Kenneth W. McGlothlen (mcglk)
"RTN","SAMIUR",39,0)
 ; mcglk@vistaexpertise.net
"RTN","SAMIUR",40,0)
 ;
"RTN","SAMIUR",41,0)
 ;@module-credits see SAMIHUL
"RTN","SAMIUR",42,0)
 ;
"RTN","SAMIUR",43,0)
 ;@module-log repo github.com:VA-PALS-ELCAP/SAMI-VAPALS-ELCAP.git
"RTN","SAMIUR",44,0)
 ; see SAMIURUL
"RTN","SAMIUR",45,0)
 ;
"RTN","SAMIUR",46,0)
 ;@contents
"RTN","SAMIUR",47,0)
 ; WSREPORT generate report based on params in filter
"RTN","SAMIUR",48,0)
 ; SORT sort patients by name
"RTN","SAMIUR",49,0)
 ; NUHREF create nuhref link to casereview for all patients
"RTN","SAMIUR",50,0)
 ; PNAME page name for report
"RTN","SAMIUR",51,0)
 ;
"RTN","SAMIUR",52,0)
 ; SELECT select patients for report
"RTN","SAMIUR",53,0)
 ; UNMAT build unmatched persons list
"RTN","SAMIUR",54,0)
 ; WKLIST build work list
"RTN","SAMIUR",55,0)
 ;
"RTN","SAMIUR",56,0)
 ;
"RTN","SAMIUR",57,0)
 ;
"RTN","SAMIUR",58,0)
 ;@section 1 wsreport subroutines
"RTN","SAMIUR",59,0)
 ;
"RTN","SAMIUR",60,0)
 ;
"RTN","SAMIUR",61,0)
 ;
"RTN","SAMIUR",62,0)
WSREPORT(SAMIRTN,filter) ; generate report based on params in filter
"RTN","SAMIUR",63,0)
 ;
"RTN","SAMIUR",64,0)
 ;@called-by
"RTN","SAMIUR",65,0)
 ; WSVAPALS^SAMIHOM4
"RTN","SAMIUR",66,0)
 ; WSREPORT^SAMIUR1
"RTN","SAMIUR",67,0)
 ;@calls
"RTN","SAMIUR",68,0)
 ; GETHOME^SAMIHOM3
"RTN","SAMIUR",69,0)
 ; getThis^%wd
"RTN","SAMIUR",70,0)
 ; SELECT
"RTN","SAMIUR",71,0)
 ; LOAD^SAMIFORM
"RTN","SAMIUR",72,0)
 ; $$PNAME
"RTN","SAMIUR",73,0)
 ; findReplace^%ts
"RTN","SAMIUR",74,0)
 ; RPTTBL^SAMIUR2
"RTN","SAMIUR",75,0)
 ; NUHREF
"RTN","SAMIUR",76,0)
 ; SORT
"RTN","SAMIUR",77,0)
 ; @RPT(ir,"routine"): [from report def table from RPTTBL^SAMIUR2]
"RTN","SAMIUR",78,0)
 ;  format = $$<tag>^SAMIUR2, where tag =
"RTN","SAMIUR",79,0)
 ;  AGE       BLINEDT   CONTACT   CTPROT   DOB      FUDATE    GENDER
"RTN","SAMIUR",80,0)
 ;  IFORM     LASTEXM   MANPAT    MATCH    NAME     PACKYRS   POSSIBLE
"RTN","SAMIUR",81,0)
 ;  RECOM     RURAL     SID       SMHIS    SMKSTAT  SSN       STUDYDT
"RTN","SAMIUR",82,0)
 ;  STUDYTYP  VALS      WHEN      WORKPAT
"RTN","SAMIUR",83,0)
 ;
"RTN","SAMIUR",84,0)
 ; here are the user reports that are defined:
"RTN","SAMIUR",85,0)
 ;  1. followup
"RTN","SAMIUR",86,0)
 ;  2. activity
"RTN","SAMIUR",87,0)
 ;  3. missingct
"RTN","SAMIUR",88,0)
 ;  4. incomplete
"RTN","SAMIUR",89,0)
 ;  5. outreach
"RTN","SAMIUR",90,0)
 ;  6. enrollment
"RTN","SAMIUR",91,0)
 ;  7. worklist
"RTN","SAMIUR",92,0)
 ; the report to generate is passed in parameter samireporttype
"RTN","SAMIUR",93,0)
 ;
"RTN","SAMIUR",94,0)
 new debug set debug=0
"RTN","SAMIUR",95,0)
 if $get(filter("debug"))=1 set debug=1
"RTN","SAMIUR",96,0)
 if $get(filter("debug"))=1 set debug=1
"RTN","SAMIUR",97,0)
 kill SAMIRTN
"RTN","SAMIUR",98,0)
 set HTTPRSP("mime")="text/html"
"RTN","SAMIUR",99,0)
 ;
"RTN","SAMIUR",100,0)
 new type,temp,site
"RTN","SAMIUR",101,0)
 s site=$g(filter("siteid"))
"RTN","SAMIUR",102,0)
 i site="" s site=$g(filter("site"))
"RTN","SAMIUR",103,0)
 i site="" d  q  ; report site missing
"RTN","SAMIUR",104,0)
 . d GETHOME^SAMIHOM3(.SAMIRTN,.filter) ; send them to home
"RTN","SAMIUR",105,0)
 ;
"RTN","SAMIUR",106,0)
 set type=$get(filter("samireporttype"))
"RTN","SAMIUR",107,0)
 if type="" do  quit  ; report type missing
"RTN","SAMIUR",108,0)
 . do GETHOME^SAMIHOM3(.SAMIRTN,.filter) ; send them to home
"RTN","SAMIUR",109,0)
 . quit
"RTN","SAMIUR",110,0)
 ;
"RTN","SAMIUR",111,0)
 if type="unmatched" i $$GET1PARM^SAMIPARM("matchingReportEnabled",site)'="true" do  quit  ;
"RTN","SAMIUR",112,0)
 . d GETHOME^SAMIHOM3(.SAMIRTN,.filter) ; send them to home
"RTN","SAMIUR",113,0)
 ;
"RTN","SAMIUR",114,0)
 do getThis^%wd("temp","table.html") ; page template
"RTN","SAMIUR",115,0)
 quit:'$data(temp)
"RTN","SAMIUR",116,0)
 ;
"RTN","SAMIUR",117,0)
 new SAMIPATS
"RTN","SAMIUR",118,0)
 ; set pats=""
"RTN","SAMIUR",119,0)
 new datephrase
"RTN","SAMIUR",120,0)
 do SELECT(.SAMIPATS,type,.datephrase,.filter) ; select pats for report
"RTN","SAMIUR",121,0)
 ; quit:'$data(SAMIPATS)
"RTN","SAMIUR",122,0)
 ;
"RTN","SAMIUR",123,0)
 new ln,cnt,ii
"RTN","SAMIUR",124,0)
 set (ii,ln,cnt)=0
"RTN","SAMIUR",125,0)
 for  do  quit:'ii  quit:$get(temp(ii))["<thead"
"RTN","SAMIUR",126,0)
 . set ii=$order(temp(ii))
"RTN","SAMIUR",127,0)
 . quit:'ii
"RTN","SAMIUR",128,0)
 . quit:$get(temp(ii))["<thead"
"RTN","SAMIUR",129,0)
 . ;
"RTN","SAMIUR",130,0)
 . set cnt=cnt+1
"RTN","SAMIUR",131,0)
 . set ln=$get(temp(ii))
"RTN","SAMIUR",132,0)
 . new samikey,si
"RTN","SAMIUR",133,0)
 . set (samikey,si)=""
"RTN","SAMIUR",134,0)
 . do LOAD^SAMIFORM(.ln,samikey,si,.filter)
"RTN","SAMIUR",135,0)
 . ; if ln["PAGE NAME" do
"RTN","SAMIUR",136,0)
 . ; . do findReplace^%ts(.ln,"PAGE NAME",$$PNAME(type,datephrase))
"RTN","SAMIUR",137,0)
 . ; . quit
"RTN","SAMIUR",138,0)
 . if ln["PAGE NAME" do
"RTN","SAMIUR",139,0)
 . . do findReplace^%ts(.ln,"PAGE NAME",$$PNAME(type,""))
"RTN","SAMIUR",140,0)
 . . quit
"RTN","SAMIUR",141,0)
 . if ln["CRITERIA" do
"RTN","SAMIUR",142,0)
 . . do findReplace^%ts(.ln,"CRITERIA",datephrase)
"RTN","SAMIUR",143,0)
 . . quit
"RTN","SAMIUR",144,0)
 . if ln["@@REPORTTYPE@@" do
"RTN","SAMIUR",145,0)
 . . do findReplace^%ts(.ln,"@@REPORTTYPE@@",type)
"RTN","SAMIUR",146,0)
 . . quit
"RTN","SAMIUR",147,0)
 . ;
"RTN","SAMIUR",148,0)
 . if ln["name=""start-date""" do
"RTN","SAMIUR",149,0)
 . . do findReplace^%ts(.ln,"start-date""","start-date"" value="""_$g(filter("start-date"))_"""")
"RTN","SAMIUR",150,0)
 . . quit
"RTN","SAMIUR",151,0)
 . if ln["name=""end-date""" do
"RTN","SAMIUR",152,0)
 . . do findReplace^%ts(.ln,"end-date""","end-date"" value="""_$g(filter("end-date"))_"""")
"RTN","SAMIUR",153,0)
 . . quit
"RTN","SAMIUR",154,0)
 . ;
"RTN","SAMIUR",155,0)
 . set SAMIRTN(cnt)=ln
"RTN","SAMIUR",156,0)
 . quit
"RTN","SAMIUR",157,0)
 ;
"RTN","SAMIUR",158,0)
 new RPT,ik
"RTN","SAMIUR",159,0)
 do RPTTBL^SAMIUR2(.RPT,type,site) ; load report definition table
"RTN","SAMIUR",160,0)
 if '$data(RPT) do  quit  ; don't know about this report
"RTN","SAMIUR",161,0)
 . do GETHOME^SAMIHOM3(.SAMIRTN,.filter) ; send them to home
"RTN","SAMIUR",162,0)
 . quit
"RTN","SAMIUR",163,0)
 ;
"RTN","SAMIUR",164,0)
 ; output header
"RTN","SAMIUR",165,0)
 ;
"RTN","SAMIUR",166,0)
 set cnt=cnt+1 set SAMIRTN(cnt)="<thead><tr>"
"RTN","SAMIUR",167,0)
 set cnt=cnt+1
"RTN","SAMIUR",168,0)
 new totcnt set totcnt=cnt
"RTN","SAMIUR",169,0)
 ;
"RTN","SAMIUR",170,0)
 set ir=""
"RTN","SAMIUR",171,0)
 for  do  quit:ir=""  ;
"RTN","SAMIUR",172,0)
 . set ir=$order(RPT(ir))
"RTN","SAMIUR",173,0)
 . quit:ir=""
"RTN","SAMIUR",174,0)
 . set cnt=cnt+1
"RTN","SAMIUR",175,0)
 . set SAMIRTN(cnt)="<th>"_$get(RPT(ir,"header"))_"</th>"
"RTN","SAMIUR",176,0)
 . quit
"RTN","SAMIUR",177,0)
 ;
"RTN","SAMIUR",178,0)
 set cnt=cnt+1 set SAMIRTN(cnt)="</tr></thead>"
"RTN","SAMIUR",179,0)
 ;
"RTN","SAMIUR",180,0)
 set cnt=cnt+1 set SAMIRTN(cnt)="<tbody>"
"RTN","SAMIUR",181,0)
 ;
"RTN","SAMIUR",182,0)
 if type'="worklist" do  ;
"RTN","SAMIUR",183,0)
 . do NUHREF(.SAMIPATS) ; create the nuhref link for all patients
"RTN","SAMIUR",184,0)
 . quit
"RTN","SAMIUR",185,0)
 ;
"RTN","SAMIUR",186,0)
 new SRT set SRT=""
"RTN","SAMIUR",187,0)
 if $get(filter("sort"))="" d  ; what kind of sort
"RTN","SAMIUR",188,0)
 . set filter("sort")="name"
"RTN","SAMIUR",189,0)
 . i type="missingct" s filter("sort")="cdate" ;sort by latest contact
"RTN","SAMIUR",190,0)
 do SORT(.SRT,.SAMIPATS,.filter)
"RTN","SAMIUR",191,0)
 ; zwrite SRT
"RTN","SAMIUR",192,0)
 ;
"RTN","SAMIUR",193,0)
 ; set ij=0
"RTN","SAMIUR",194,0)
 ; for  do  quit:'ij  ;
"RTN","SAMIUR",195,0)
 ; . set ij=$order(SAMIPATS(ij))
"RTN","SAMIUR",196,0)
 ; . quit:'ij  
"RTN","SAMIUR",197,0)
 ; . new ij2 set ij2=0
"RTN","SAMIUR",198,0)
 ; . for  do  quit:'ij2  ;
"RTN","SAMIUR",199,0)
 ; . . set ij2=$order(SAMIPATS(ij,ij2))
"RTN","SAMIUR",200,0)
 ; . . quit:'ij2  
"RTN","SAMIUR",201,0)
 ; . . new dfn set dfn=ij2
"RTN","SAMIUR",202,0)
 ; . . quit
"RTN","SAMIUR",203,0)
 ; . quit
"RTN","SAMIUR",204,0)
 ;
"RTN","SAMIUR",205,0)
 new iz,ij,ij2,dfn,rows
"RTN","SAMIUR",206,0)
 set rows=0
"RTN","SAMIUR",207,0)
 set (iz,ij,ij2,dfn)=""
"RTN","SAMIUR",208,0)
 for  do  quit:iz=""  ;
"RTN","SAMIUR",209,0)
 . set iz=$order(SRT(iz))
"RTN","SAMIUR",210,0)
 . quit:iz=""
"RTN","SAMIUR",211,0)
 . set ij=$order(SRT(iz,""))
"RTN","SAMIUR",212,0)
 . set dfn=$order(SRT(iz,ij,""))
"RTN","SAMIUR",213,0)
 . do  ;
"RTN","SAMIUR",214,0)
 . . set cnt=cnt+1 set SAMIRTN(cnt)="<tr>"
"RTN","SAMIUR",215,0)
 . . set ir=""
"RTN","SAMIUR",216,0)
 . . for  do  quit:ir=""  ;
"RTN","SAMIUR",217,0)
 . . . set ir=$order(RPT(ir))
"RTN","SAMIUR",218,0)
 . . . quit:ir=""
"RTN","SAMIUR",219,0)
 . . . set cnt=cnt+1
"RTN","SAMIUR",220,0)
 . . . new XR,XRV
"RTN","SAMIUR",221,0)
 . . . ; set XR=$get(RPT(ir,"routine"))_"("_ij_",.SAMIPATS)"
"RTN","SAMIUR",222,0)
 . . . set XR="set XRV="_$get(RPT(ir,"routine"))_"("_ij_","_dfn_",.SAMIPATS)"
"RTN","SAMIUR",223,0)
 . . . ; set XRV=@XR
"RTN","SAMIUR",224,0)
 . . . xecute XR ; call report-field handlers in ^SAMIUR2
"RTN","SAMIUR",225,0)
 . . . if $extract(XRV,1,3)["<td" set SAMIRTN(cnt)=XRV
"RTN","SAMIUR",226,0)
 . . . else  set SAMIRTN(cnt)="<td>"_$get(XRV)_"</td>"
"RTN","SAMIUR",227,0)
 . . . quit
"RTN","SAMIUR",228,0)
 . . ;
"RTN","SAMIUR",229,0)
 . . set cnt=cnt+1
"RTN","SAMIUR",230,0)
 . . set SAMIRTN(cnt)="</tr>"_$CHAR(10,13)
"RTN","SAMIUR",231,0)
 . . set rows=rows+1
"RTN","SAMIUR",232,0)
 . . quit
"RTN","SAMIUR",233,0)
 . quit
"RTN","SAMIUR",234,0)
 ;
"RTN","SAMIUR",235,0)
 set cnt=cnt+1
"RTN","SAMIUR",236,0)
 ;set SAMIRTN(cnt)="<tr><td>Total: "_rows_"</td></tr>"
"RTN","SAMIUR",237,0)
 ;set SAMIRTN(totcnt)="<td>Total: "_rows_"</td></tr><tr>"
"RTN","SAMIUR",238,0)
 ;
"RTN","SAMIUR",239,0)
 set cnt=cnt+1 set SAMIRTN(cnt)="</tbody>"
"RTN","SAMIUR",240,0)
 for  do  quit:temp(ii)["</tbody>"  ;
"RTN","SAMIUR",241,0)
 . set ii=$order(temp(ii))
"RTN","SAMIUR",242,0)
 . quit:temp(ii)["</tbody>"
"RTN","SAMIUR",243,0)
 . ; skip past template headers & blank body
"RTN","SAMIUR",244,0)
 . quit
"RTN","SAMIUR",245,0)
 ;
"RTN","SAMIUR",246,0)
 for  do  quit:'ii  ;
"RTN","SAMIUR",247,0)
 . set ii=$order(temp(ii))
"RTN","SAMIUR",248,0)
 . quit:'ii
"RTN","SAMIUR",249,0)
 . set cnt=cnt+1
"RTN","SAMIUR",250,0)
 . set ln=$get(temp(ii))
"RTN","SAMIUR",251,0)
 . new samikey,si
"RTN","SAMIUR",252,0)
 . set (samikey,si)=""
"RTN","SAMIUR",253,0)
 . do LOAD^SAMIFORM(.ln,samikey,si,.filter)
"RTN","SAMIUR",254,0)
 . set SAMIRTN(cnt)=ln
"RTN","SAMIUR",255,0)
 . quit
"RTN","SAMIUR",256,0)
 ;
"RTN","SAMIUR",257,0)
 quit  ; end of WSREPORT
"RTN","SAMIUR",258,0)
 ;
"RTN","SAMIUR",259,0)
 ;
"RTN","SAMIUR",260,0)
SORT(SRTN,SAMIPATS,FILTER) ; sort patients by name
"RTN","SAMIUR",261,0)
 ;
"RTN","SAMIUR",262,0)
 ;@called-by
"RTN","SAMIUR",263,0)
 ; WSREPORT
"RTN","SAMIUR",264,0)
 ;@calls
"RTN","SAMIUR",265,0)
 ; $$UPCASE^XLFMSMT
"RTN","SAMIUR",266,0)
 ;
"RTN","SAMIUR",267,0)
 new typ set typ=$get(FILTER("sort"))
"RTN","SAMIUR",268,0)
 ;
"RTN","SAMIUR",269,0)
 if typ="" set typ="name"
"RTN","SAMIUR",270,0)
 new iz,dt,dfn,nm,cdate
"RTN","SAMIUR",271,0)
 set (dt,dfn,nm)="" ; note: should dfn be initialized inside loop?
"RTN","SAMIUR",272,0)
 set iz=0
"RTN","SAMIUR",273,0)
 ;
"RTN","SAMIUR",274,0)
 new indx
"RTN","SAMIUR",275,0)
 for  do  quit:'dt  ;
"RTN","SAMIUR",276,0)
 . set dt=$order(SAMIPATS(dt))
"RTN","SAMIUR",277,0)
 . quit:'dt
"RTN","SAMIUR",278,0)
 . ; note: dfn not re-initialized to "" here; should it be?
"RTN","SAMIUR",279,0)
 . for  do  quit:'dfn  ;
"RTN","SAMIUR",280,0)
 . . set dfn=$order(SAMIPATS(dt,dfn))
"RTN","SAMIUR",281,0)
 . . quit:'dfn
"RTN","SAMIUR",282,0)
 . . if typ="name" do  ;
"RTN","SAMIUR",283,0)
 . . . set nm=$get(SAMIPATS(dt,dfn,"name"))
"RTN","SAMIUR",284,0)
 . . . set nm=$$UPCASE^XLFMSMT(nm)
"RTN","SAMIUR",285,0)
 . . . if nm="" set nm=" "
"RTN","SAMIUR",286,0)
 . . . set indx(nm,dt,dfn)=""
"RTN","SAMIUR",287,0)
 . . . quit
"RTN","SAMIUR",288,0)
 . . if typ="cdate" do  ;
"RTN","SAMIUR",289,0)
 . . . set cdate=$$LDOC^SAMIUR2(dt,dfn,.SAMIPATS)
"RTN","SAMIUR",290,0)
 . . . set cdate=$$FMDT^SAMIUR2(cdate)
"RTN","SAMIUR",291,0)
 . . . set indx(cdate,dt,dfn)=""
"RTN","SAMIUR",292,0)
 . . quit
"RTN","SAMIUR",293,0)
 . quit
"RTN","SAMIUR",294,0)
 ;
"RTN","SAMIUR",295,0)
 new iiz set iiz=""
"RTN","SAMIUR",296,0)
 set (dt,dfn)="" ; note: here, too, should inits be inside loops?
"RTN","SAMIUR",297,0)
 for  do  quit:iiz=""  ;
"RTN","SAMIUR",298,0)
 . set iiz=$order(indx(iiz))
"RTN","SAMIUR",299,0)
 . quit:iiz=""
"RTN","SAMIUR",300,0)
 . for  do  quit:dt=""  ;
"RTN","SAMIUR",301,0)
 . . set dt=$order(indx(iiz,dt))
"RTN","SAMIUR",302,0)
 . . quit:dt=""
"RTN","SAMIUR",303,0)
 . . for  do  quit:dfn=""  ;
"RTN","SAMIUR",304,0)
 . . . set dfn=$order(indx(iiz,dt,dfn))
"RTN","SAMIUR",305,0)
 . . . quit:dfn=""
"RTN","SAMIUR",306,0)
 . . . set iz=iz+1
"RTN","SAMIUR",307,0)
 . . . set SRTN(iz,dt,dfn)=iiz
"RTN","SAMIUR",308,0)
 . . . quit
"RTN","SAMIUR",309,0)
 . . quit
"RTN","SAMIUR",310,0)
 . quit
"RTN","SAMIUR",311,0)
 ;
"RTN","SAMIUR",312,0)
 quit  ; end of SORT
"RTN","SAMIUR",313,0)
 ;
"RTN","SAMIUR",314,0)
 ;
"RTN","SAMIUR",315,0)
 ;
"RTN","SAMIUR",316,0)
NUHREF(SAMIPATS) ; create nuhref link to casereview for all patients
"RTN","SAMIUR",317,0)
 ;
"RTN","SAMIUR",318,0)
 ;@called-by
"RTN","SAMIUR",319,0)
 ; WSREPORT
"RTN","SAMIUR",320,0)
 ;@calls
"RTN","SAMIUR",321,0)
 ; $$setroot^%wd
"RTN","SAMIUR",322,0)
 ; $$GETSSN^SAMIFORM
"RTN","SAMIUR",323,0)
 ;
"RTN","SAMIUR",324,0)
 new ij
"RTN","SAMIUR",325,0)
 new root set root=$$setroot^%wd("vapals-patients")
"RTN","SAMIUR",326,0)
 set ij=0
"RTN","SAMIUR",327,0)
 for  do  quit:'ij  ;
"RTN","SAMIUR",328,0)
 . set ij=$order(SAMIPATS(ij))
"RTN","SAMIUR",329,0)
 . quit:'ij
"RTN","SAMIUR",330,0)
 . new ij2 set ij2=0
"RTN","SAMIUR",331,0)
 . for  do  quit:'ij2  ;
"RTN","SAMIUR",332,0)
 . . set ij2=$order(SAMIPATS(ij,ij2))
"RTN","SAMIUR",333,0)
 . . quit:'ij2
"RTN","SAMIUR",334,0)
 . . ;
"RTN","SAMIUR",335,0)
 . . new dfn set dfn=ij2
"RTN","SAMIUR",336,0)
 . . set SAMIPATS(ij,dfn,"sid")=$get(@root@(dfn,"samistudyid"))
"RTN","SAMIUR",337,0)
 . . set SAMIPATS(ij,dfn,"name")=$get(@root@(dfn,"saminame"))
"RTN","SAMIUR",338,0)
 . . ;
"RTN","SAMIUR",339,0)
 . . new sid set sid=SAMIPATS(ij,dfn,"sid")
"RTN","SAMIUR",340,0)
 . . set SAMIPATS(ij,dfn,"ssn")=$$GETSSN^SAMIFORM(sid)
"RTN","SAMIUR",341,0)
 . . new name set name=SAMIPATS(ij,dfn,"name")
"RTN","SAMIUR",342,0)
 . . ;
"RTN","SAMIUR",343,0)
 . . new nuhref
"RTN","SAMIUR",344,0)
 . . set nuhref="<td data-order="""_name_""" data-search="""_name_""">"
"RTN","SAMIUR",345,0)
 . . set nuhref=nuhref_"<form method=POST action=""/vapals"">"
"RTN","SAMIUR",346,0)
 . . set nuhref=nuhref_"<input type=hidden name=""samiroute"" value=""casereview"">"
"RTN","SAMIUR",347,0)
 . . set nuhref=nuhref_"<input type=hidden name=""studyid"" value="_sid_">"
"RTN","SAMIUR",348,0)
 . . set nuhref=nuhref_"<input value="""_name_""" class=""btn btn-link"" role=""link"" type=""submit""></form>"
"RTN","SAMIUR",349,0)
 . . set nuhref=nuhref_"</td>"
"RTN","SAMIUR",350,0)
 . . set SAMIPATS(ij,dfn,"nuhref")=nuhref
"RTN","SAMIUR",351,0)
 . . quit
"RTN","SAMIUR",352,0)
 . quit
"RTN","SAMIUR",353,0)
 ;
"RTN","SAMIUR",354,0)
 quit  ; end of NUHREF
"RTN","SAMIUR",355,0)
 ;
"RTN","SAMIUR",356,0)
 ;
"RTN","SAMIUR",357,0)
 ;
"RTN","SAMIUR",358,0)
PNAME(type,phrase) ; page name for report
"RTN","SAMIUR",359,0)
 ;
"RTN","SAMIUR",360,0)
 ;@called-by
"RTN","SAMIUR",361,0)
 ; WSREPORT
"RTN","SAMIUR",362,0)
 ;@calls none
"RTN","SAMIUR",363,0)
 ;
"RTN","SAMIUR",364,0)
 ; extrinsic returns the PAGE NAME for the report
"RTN","SAMIUR",365,0)
 ;
"RTN","SAMIUR",366,0)
 ; if type="followup" quit "Participant Followup next 30 days -"_$get(phrase)
"RTN","SAMIUR",367,0)
 if type="followup" quit "Participant Followup "_$get(phrase)
"RTN","SAMIUR",368,0)
 ; if type="activity" quit "Activity last 30 days -"_$get(phrase)
"RTN","SAMIUR",369,0)
 if type="activity" quit "Activity "_$get(phrase)
"RTN","SAMIUR",370,0)
 if type="missingct" quit "Intake but no CT Evaluation"_$get(phrase)
"RTN","SAMIUR",371,0)
 if type="incomplete" quit "Incomplete Forms"_$get(phrase)
"RTN","SAMIUR",372,0)
 if type="outreach" quit "Outreach"_$get(phrase)
"RTN","SAMIUR",373,0)
 if type="enrollment" quit "Enrollment"_$get(phrase)
"RTN","SAMIUR",374,0)
 if type="inactive" quit "Inactive"_$get(phrase)
"RTN","SAMIUR",375,0)
 ;
"RTN","SAMIUR",376,0)
 quit "" ; end of $$PNAME
"RTN","SAMIUR",377,0)
 ;
"RTN","SAMIUR",378,0)
 ;
"RTN","SAMIUR",379,0)
 ;
"RTN","SAMIUR",380,0)
 ;@section 2 select subroutines
"RTN","SAMIUR",381,0)
 ;
"RTN","SAMIUR",382,0)
 ;
"RTN","SAMIUR",383,0)
 ;
"RTN","SAMIUR",384,0)
SELECT(SAMIPATS,ztype,datephrase,filter) ; select patients for report
"RTN","SAMIUR",385,0)
 ;
"RTN","SAMIUR",386,0)
 ;@called-by
"RTN","SAMIUR",387,0)
 ; WSREPORT
"RTN","SAMIUR",388,0)
 ;@calls
"RTN","SAMIUR",389,0)
 ; UNMAT
"RTN","SAMIUR",390,0)
 ; WKLIST
"RTN","SAMIUR",391,0)
 ; $$KEY2FM^SAMICASE
"RTN","SAMIUR",392,0)
 ; $$NOW^XLFDT
"RTN","SAMIUR",393,0)
 ; $$FMADD^XLFDT
"RTN","SAMIUR",394,0)
 ; $$VAPALSDT^SAMICASE
"RTN","SAMIUR",395,0)
 ; $$setroot^%wd
"RTN","SAMIUR",396,0)
 ; GETITEMS^SAMICASE
"RTN","SAMIUR",397,0)
 ;
"RTN","SAMIUR",398,0)
 ; merge ^gpl("select")=filter
"RTN","SAMIUR",399,0)
 new type set type=ztype
"RTN","SAMIUR",400,0)
 if type="unmatched" do  quit  ;
"RTN","SAMIUR",401,0)
 . do UNMAT(.SAMIPATS,ztype,.datephrase,.filter)
"RTN","SAMIUR",402,0)
 . quit
"RTN","SAMIUR",403,0)
 if type="worklist" do  quit  ;
"RTN","SAMIUR",404,0)
 . do WKLIST(.SAMIPATS,ztype,.datephrase,.filter)
"RTN","SAMIUR",405,0)
 . quit
"RTN","SAMIUR",406,0)
 if $get(type)="" set type="enrollment"
"RTN","SAMIUR",407,0)
 if type="cumpy" set type="enrollment"
"RTN","SAMIUR",408,0)
 new site set site=$get(filter("siteid"))
"RTN","SAMIUR",409,0)
 ;
"RTN","SAMIUR",410,0)
 new strdt,enddt,fmstrdt,fmenddt
"RTN","SAMIUR",411,0)
 set strdt=$get(filter("start-date"))
"RTN","SAMIUR",412,0)
 ;set fmstrdt=$$KEY2FM^SAMICASE(strdt)
"RTN","SAMIUR",413,0)
 set fmstrdt=$$FMDT^SAMIUR2(strdt)
"RTN","SAMIUR",414,0)
 if fmstrdt=-1 do  ;
"RTN","SAMIUR",415,0)
 . set fmstrdt=2000101
"RTN","SAMIUR",416,0)
 . if type="followup" set fmstrdt=$$NOW^XLFDT
"RTN","SAMIUR",417,0)
 . if type="activity" set fmstrdt=$$FMADD^XLFDT($$NOW^XLFDT,-31)
"RTN","SAMIUR",418,0)
 . quit
"RTN","SAMIUR",419,0)
 if strdt="" set filter("start-date")=$$VAPALSDT^SAMICASE(fmstrdt)
"RTN","SAMIUR",420,0)
 ;
"RTN","SAMIUR",421,0)
 set enddt=$get(filter("end-date"))
"RTN","SAMIUR",422,0)
 ;set fmenddt=$$KEY2FM^SAMICASE(enddt)
"RTN","SAMIUR",423,0)
 set fmenddt=$$FMDT^SAMIUR2(enddt)
"RTN","SAMIUR",424,0)
 if fmenddt=-1 do  ;
"RTN","SAMIUR",425,0)
 . set fmenddt=$$NOW^XLFDT
"RTN","SAMIUR",426,0)
 . if type="followup" set fmenddt=$$FMADD^XLFDT($$NOW^XLFDT,31)
"RTN","SAMIUR",427,0)
 . quit
"RTN","SAMIUR",428,0)
 if enddt="" set filter("end-date")=$$VAPALSDT^SAMICASE(fmenddt)
"RTN","SAMIUR",429,0)
 ;
"RTN","SAMIUR",430,0)
 set datephrase=""
"RTN","SAMIUR",431,0)
 new zi set zi=0
"RTN","SAMIUR",432,0)
 new root set root=$$setroot^%wd("vapals-patients")
"RTN","SAMIUR",433,0)
 ;
"RTN","SAMIUR",434,0)
 for  do  quit:'zi  ;
"RTN","SAMIUR",435,0)
 . set zi=$order(@root@(zi))
"RTN","SAMIUR",436,0)
 . quit:'zi
"RTN","SAMIUR",437,0)
 . ;
"RTN","SAMIUR",438,0)
 . new sid set sid=$get(@root@(zi,"samistudyid"))
"RTN","SAMIUR",439,0)
 . quit:sid=""
"RTN","SAMIUR",440,0)
 . quit:$extract(sid,1,3)'=site
"RTN","SAMIUR",441,0)
 . ;
"RTN","SAMIUR",442,0)
 . new items set items=""
"RTN","SAMIUR",443,0)
 . do GETITEMS^SAMICASE("items",sid)
"RTN","SAMIUR",444,0)
 . quit:'$data(items)
"RTN","SAMIUR",445,0)
 . ;
"RTN","SAMIUR",446,0)
 . new efmdate,edate,siform,ceform,cefud,fmcefud,cedos,fmcedos
"RTN","SAMIUR",447,0)
 . set siform=$order(items("siform-"))
"RTN","SAMIUR",448,0)
 . new status set status=$get(@root@("graph",sid,siform,"sistatus"))
"RTN","SAMIUR",449,0)
 . if type="inactive",status="active" quit  ; for inactive report
"RTN","SAMIUR",450,0)
 . ;if type'="inactive",status'="active" quit  ; for other reports
"RTN","SAMIUR",451,0)
 . if type'="inactive",type'="enrollment",status'="active" quit  ;other rpts
"RTN","SAMIUR",452,0)
 . new eligible set eligible=$get(@root@("graph",sid,siform,"sicechrt"))
"RTN","SAMIUR",453,0)
 . if type="enrollment",eligible'="y" quit  ; must be eligible
"RTN","SAMIUR",454,0)
 . new enrolled set enrolled=$g(@root@("graph",sid,siform,"sildct"))
"RTN","SAMIUR",455,0)
 . if type="enrollment",enrolled'="y" quit  ; must be enrolled
"RTN","SAMIUR",456,0)
 . ;
"RTN","SAMIUR",457,0)
 . set (ceform,cefud,fmcefud,cedos,fmcedos)=""
"RTN","SAMIUR",458,0)
 . new lastce,sifm,cefm
"RTN","SAMIUR",459,0)
 . set (lastce,sifm,cefm)=""
"RTN","SAMIUR",460,0)
 . set sifm=$$FMDT^SAMIUR2(siform)
"RTN","SAMIUR",461,0)
 . f  set ceform=$order(items(ceform),-1) q:ceform=""  q:cefud'=""  d  ;
"RTN","SAMIUR",462,0)
 . . q:ceform'["ceform"
"RTN","SAMIUR",463,0)
 . . if lastce="" set lastce=ceform
"RTN","SAMIUR",464,0)
 . . set cefud=$get(@root@("graph",sid,ceform,"cefud"))
"RTN","SAMIUR",465,0)
 . . if cefud'="" set fmcefud=$$FMDT^SAMIUR2(cefud)
"RTN","SAMIUR",466,0)
 . . set cedos=$get(@root@("graph",sid,ceform,"cedos"))
"RTN","SAMIUR",467,0)
 . . if cedos'="" set fmcedos=$$FMDT^SAMIUR2(cedos)
"RTN","SAMIUR",468,0)
 . . quit
"RTN","SAMIUR",469,0)
 . if $$FMDT^SAMIUR2(lastce)<sifm set lastce=""
"RTN","SAMIUR",470,0)
 . ;
"RTN","SAMIUR",471,0)
 . set edate=$get(@root@("graph",sid,siform,"sidc"))
"RTN","SAMIUR",472,0)
 . if edate="" set edate=$get(@root@("graph",sid,siform,"samicreatedate"))
"RTN","SAMIUR",473,0)
 . set efmdate=$$FMDT^SAMIUR2(edate)
"RTN","SAMIUR",474,0)
 . set edate=$$VAPALSDT^SAMICASE(efmdate)
"RTN","SAMIUR",475,0)
 . ;
"RTN","SAMIUR",476,0)
 . new latef,latefdt set (latef,latefdt)="" ; latest form for activity report
"RTN","SAMIUR",477,0)
 . new aform,aformdt set (aform,aformdt)=""
"RTN","SAMIUR",478,0)
 . new anyform set anyform=""
"RTN","SAMIUR",479,0)
 . new proot set proot=$na(@root@("graph",sid))
"RTN","SAMIUR",480,0)
 . for  set anyform=$order(items("sort",anyform),-1) q:aform'=""  q:anyform=""  d  ;
"RTN","SAMIUR",481,0)
 . . new tempf set tempf=""
"RTN","SAMIUR",482,0)
 . . f  set tempf=$order(items("sort",anyform,tempf)) q:tempf=""  q:aform'=""  d  ;
"RTN","SAMIUR",483,0)
 . . . if latef="" d  ; record the latest form for activity report
"RTN","SAMIUR",484,0)
 . . . . set latefdt=anyform ; date of latest form
"RTN","SAMIUR",485,0)
 . . . . new latekey set latekey=$order(items("sort",anyform,tempf,""))
"RTN","SAMIUR",486,0)
 . . . . set latef=$order(items("sort",anyform,tempf,latekey,""))
"RTN","SAMIUR",487,0)
 . . . if tempf["bxform" q  ; don't want any biopsy forms
"RTN","SAMIUR",488,0)
 . . . new tempk set tempk=$order(items("sort",anyform,tempf,""))
"RTN","SAMIUR",489,0)
 . . . if $g(@proot@(tempk,"cefud"))="" q  ; no followup date
"RTN","SAMIUR",490,0)
 . . . new tempt set tempt=$order(items("sort",anyform,tempf,tempk,""))
"RTN","SAMIUR",491,0)
 . . . set cefud=$g(@proot@(tempk,"cefud"))
"RTN","SAMIUR",492,0)
 . . . set fmcefud=$$FMDT^SAMIUR2(cefud)
"RTN","SAMIUR",493,0)
 . . . set aform=tempt
"RTN","SAMIUR",494,0)
 . . . set aformdt=anyform
"RTN","SAMIUR",495,0)
 . ;
"RTN","SAMIUR",496,0)
 . if type="followup" do  ;
"RTN","SAMIUR",497,0)
 . . ; new nplus30 set nplus30=$$FMADD^XLFDT($$NOW^XLFDT,31)
"RTN","SAMIUR",498,0)
 . . if +fmcefud<fmstrdt quit  ; before start date
"RTN","SAMIUR",499,0)
 . . if +fmcefud<(fmenddt+1) do  ; before end date
"RTN","SAMIUR",500,0)
 . . . quit:cefud=""  ; no followup date
"RTN","SAMIUR",501,0)
 . . . set SAMIPATS(fmcefud,zi,"aform")=aform
"RTN","SAMIUR",502,0)
 . . . set SAMIPATS(fmcefud,zi,"aformdt")=aformdt
"RTN","SAMIUR",503,0)
 . . . set SAMIPATS(fmcefud,zi,"edate")=edate
"RTN","SAMIUR",504,0)
 . . . set SAMIPATS(fmcefud,zi)=""
"RTN","SAMIUR",505,0)
 . . . ;if ceform="" set cefud="baseline"
"RTN","SAMIUR",506,0)
 . . . set SAMIPATS(fmcefud,zi,"cefud")=cefud
"RTN","SAMIUR",507,0)
 . . . set SAMIPATS(fmcefud,zi,"cedos")=cedos
"RTN","SAMIUR",508,0)
 . . . set SAMIPATS(fmcefud,zi,"ceform")=ceform
"RTN","SAMIUR",509,0)
 . . . set SAMIPATS(fmcefud,zi,"ceform-vals")=$name(@root@("graph",sid,ceform))
"RTN","SAMIUR",510,0)
 . . . set SAMIPATS(fmcefud,zi,"siform")=siform
"RTN","SAMIUR",511,0)
 . . . set SAMIPATS(fmcefud,zi,"siform-vals")=$name(@root@("graph",sid,siform))
"RTN","SAMIUR",512,0)
 . . . merge SAMIPATS(fmcefud,zi,"items")=items
"RTN","SAMIUR",513,0)
 . . . quit
"RTN","SAMIUR",514,0)
 . . set datephrase=" before "_$$VAPALSDT^SAMICASE(fmenddt)
"RTN","SAMIUR",515,0)
 . . quit
"RTN","SAMIUR",516,0)
 . ;
"RTN","SAMIUR",517,0)
 . if type="activity" do  ;
"RTN","SAMIUR",518,0)
 . . new fmanyform set fmanyform=$$FMDT^SAMIUR2(latefdt)
"RTN","SAMIUR",519,0)
 . . if fmanyform<fmstrdt quit  ; before the start date
"RTN","SAMIUR",520,0)
 . . ; if fmanyform<(fmenddt+1)!(efmdate>fmenddt) do  ; need any new form
"RTN","SAMIUR",521,0)
 . . if fmanyform<(fmenddt+1)  do  ;
"RTN","SAMIUR",522,0)
 . . . set SAMIPATS(efmdate,zi,"aform")=latef
"RTN","SAMIUR",523,0)
 . . . set SAMIPATS(efmdate,zi,"aformdt")=$$VAPALSDT^SAMICASE(fmanyform)
"RTN","SAMIUR",524,0)
 . . . set SAMIPATS(efmdate,zi,"edate")=edate
"RTN","SAMIUR",525,0)
 . . . set SAMIPATS(efmdate,zi)=""
"RTN","SAMIUR",526,0)
 . . . if ceform="" set cefud="baseline"
"RTN","SAMIUR",527,0)
 . . . set SAMIPATS(efmdate,zi,"cefud")=cefud
"RTN","SAMIUR",528,0)
 . . . set SAMIPATS(efmdate,zi,"cedos")=cedos
"RTN","SAMIUR",529,0)
 . . . set SAMIPATS(efmdate,zi,"ceform")=ceform
"RTN","SAMIUR",530,0)
 . . . set SAMIPATS(efmdate,zi,"siform")=siform
"RTN","SAMIUR",531,0)
 . . . merge SAMIPATS(efmdate,zi,"items")=items
"RTN","SAMIUR",532,0)
 . . . quit
"RTN","SAMIUR",533,0)
 . . set datephrase=" after "_$$VAPALSDT^SAMICASE(fmstrdt)
"RTN","SAMIUR",534,0)
 . . quit
"RTN","SAMIUR",535,0)
 . ;
"RTN","SAMIUR",536,0)
 . ; date filter for all the rest of the reports
"RTN","SAMIUR",537,0)
 . ;
"RTN","SAMIUR",538,0)
 . quit:efmdate<fmstrdt  ; before the start date
"RTN","SAMIUR",539,0)
 . quit:efmdate>(fmenddt+1)  ; after the end date
"RTN","SAMIUR",540,0)
 . ;
"RTN","SAMIUR",541,0)
 . if type="incomplete" do  ;
"RTN","SAMIUR",542,0)
 . . new complete set complete=1
"RTN","SAMIUR",543,0)
 . . new zj set zj=""
"RTN","SAMIUR",544,0)
 . . new gr set gr=$name(@root@("graph",sid))
"RTN","SAMIUR",545,0)
 . . for  do  quit:zj=""  ;
"RTN","SAMIUR",546,0)
 . . . set zj=$order(@gr@(zj))
"RTN","SAMIUR",547,0)
 . . . quit:zj=""
"RTN","SAMIUR",548,0)
 . . . ;
"RTN","SAMIUR",549,0)
 . . . new stat
"RTN","SAMIUR",550,0)
 . . . set stat=$get(@gr@(zj,"samistatus"))
"RTN","SAMIUR",551,0)
 . . . if stat="" set stat="incomplete"
"RTN","SAMIUR",552,0)
 . . . if stat="incomplete" do  ;
"RTN","SAMIUR",553,0)
 . . . . set complete=0
"RTN","SAMIUR",554,0)
 . . . . set SAMIPATS(efmdate,zi,"iform")=$get(SAMIPATS(efmdate,zi,"iform"))_" "_zj
"RTN","SAMIUR",555,0)
 . . . . quit
"RTN","SAMIUR",556,0)
 . . . quit
"RTN","SAMIUR",557,0)
 . . ;
"RTN","SAMIUR",558,0)
 . . if complete=0 do  ; has incomplete form(s) 
"RTN","SAMIUR",559,0)
 . . . set SAMIPATS(efmdate,zi,"edate")=edate
"RTN","SAMIUR",560,0)
 . . . set SAMIPATS(efmdate,zi)=""
"RTN","SAMIUR",561,0)
 . . . if ceform="" set cefud="baseline"
"RTN","SAMIUR",562,0)
 . . . set SAMIPATS(efmdate,zi,"cefud")=cefud
"RTN","SAMIUR",563,0)
 . . . set SAMIPATS(efmdate,zi,"ceform")=ceform
"RTN","SAMIUR",564,0)
 . . . set SAMIPATS(efmdate,zi,"siform")=siform
"RTN","SAMIUR",565,0)
 . . . merge SAMIPATS(efmdate,zi,"items")=items
"RTN","SAMIUR",566,0)
 . . . quit
"RTN","SAMIUR",567,0)
 . . set datephrase=""
"RTN","SAMIUR",568,0)
 . . quit
"RTN","SAMIUR",569,0)
 . ;
"RTN","SAMIUR",570,0)
 . if type="missingct" do  ;
"RTN","SAMIUR",571,0)
 . . if lastce="" do  ; has no ct since enrollment 
"RTN","SAMIUR",572,0)
 . . . set SAMIPATS(efmdate,zi,"edate")=edate
"RTN","SAMIUR",573,0)
 . . . set SAMIPATS(efmdate,zi)=""
"RTN","SAMIUR",574,0)
 . . . ;if ceform="" set cefud="baseline"
"RTN","SAMIUR",575,0)
 . . . set SAMIPATS(efmdate,zi,"cefud")=cefud
"RTN","SAMIUR",576,0)
 . . . set SAMIPATS(efmdate,zi,"ceform")=ceform
"RTN","SAMIUR",577,0)
 . . . set SAMIPATS(efmdate,zi,"siform")=siform
"RTN","SAMIUR",578,0)
 . . . merge SAMIPATS(efmdate,zi,"items")=items
"RTN","SAMIUR",579,0)
 . . . quit
"RTN","SAMIUR",580,0)
 . . set datephrase=""
"RTN","SAMIUR",581,0)
 . . quit
"RTN","SAMIUR",582,0)
 . ;
"RTN","SAMIUR",583,0)
 . if type="outreach" do  ; no-op; hook for future development?
"RTN","SAMIUR",584,0)
 . . quit
"RTN","SAMIUR",585,0)
 . ;
"RTN","SAMIUR",586,0)
 . if type="enrollment" do  ;
"RTN","SAMIUR",587,0)
 . . set SAMIPATS(efmdate,zi,"edate")=edate
"RTN","SAMIUR",588,0)
 . . set SAMIPATS(efmdate,zi)=""
"RTN","SAMIUR",589,0)
 . . set SAMIPATS(efmdate,zi,"cefud")=cefud
"RTN","SAMIUR",590,0)
 . . set SAMIPATS(efmdate,zi,"ceform")=ceform
"RTN","SAMIUR",591,0)
 . . set SAMIPATS(efmdate,zi,"cedos")=cedos
"RTN","SAMIUR",592,0)
 . . set SAMIPATS(efmdate,zi,"siform")=siform
"RTN","SAMIUR",593,0)
 . . merge SAMIPATS(efmdate,zi,"items")=items
"RTN","SAMIUR",594,0)
 . . quit
"RTN","SAMIUR",595,0)
 . ;
"RTN","SAMIUR",596,0)
 . if type="inactive" do  ;
"RTN","SAMIUR",597,0)
 . . set SAMIPATS(efmdate,zi,"edate")=edate
"RTN","SAMIUR",598,0)
 . . set SAMIPATS(efmdate,zi)=""
"RTN","SAMIUR",599,0)
 . . set SAMIPATS(efmdate,zi,"cefud")=cefud
"RTN","SAMIUR",600,0)
 . . set SAMIPATS(efmdate,zi,"ceform")=ceform
"RTN","SAMIUR",601,0)
 . . set SAMIPATS(efmdate,zi,"cedos")=cedos
"RTN","SAMIUR",602,0)
 . . set SAMIPATS(efmdate,zi,"siform")=siform
"RTN","SAMIUR",603,0)
 . . merge SAMIPATS(efmdate,zi,"items")=items
"RTN","SAMIUR",604,0)
 . . quit
"RTN","SAMIUR",605,0)
 . ;
"RTN","SAMIUR",606,0)
 . set datephrase=" as of "_$$VAPALSDT^SAMICASE($$NOW^XLFDT)
"RTN","SAMIUR",607,0)
 . quit
"RTN","SAMIUR",608,0)
 ;
"RTN","SAMIUR",609,0)
 quit  ; end of SELECT
"RTN","SAMIUR",610,0)
 ;
"RTN","SAMIUR",611,0)
 ;
"RTN","SAMIUR",612,0)
 ;
"RTN","SAMIUR",613,0)
UNMAT(SAMIPATS,ztype,datephrase,filter) ; build unmatched persons list
"RTN","SAMIUR",614,0)
 ;
"RTN","SAMIUR",615,0)
 ;@called-by
"RTN","SAMIUR",616,0)
 ; SELECT
"RTN","SAMIUR",617,0)
 ;@calls
"RTN","SAMIUR",618,0)
 ; $$setroot^%wd
"RTN","SAMIUR",619,0)
 ;
"RTN","SAMIUR",620,0)
 set datephrase="Unmatched Persons"
"RTN","SAMIUR",621,0)
 new lroot set lroot=$$setroot^%wd("patient-lookup")
"RTN","SAMIUR",622,0)
 new dfn set dfn=9000000
"RTN","SAMIUR",623,0)
 for  do  quit:'dfn  ;
"RTN","SAMIUR",624,0)
 . set dfn=$order(@lroot@("dfn",dfn))
"RTN","SAMIUR",625,0)
 . quit:'dfn
"RTN","SAMIUR",626,0)
 . ;
"RTN","SAMIUR",627,0)
 . new ien set ien=$order(@lroot@("dfn",dfn,""))
"RTN","SAMIUR",628,0)
 . quit:ien=""
"RTN","SAMIUR",629,0)
 . n ordern
"RTN","SAMIUR",630,0)
 . s ordern=$g(@lroot@(ien,"ORMORCordernumber"))
"RTN","SAMIUR",631,0)
 . i ordern="" s ordern=$g(@lroot@(ien,"ORM",1,"ordernumber"))
"RTN","SAMIUR",632,0)
 . i ordern'="" q  ;
"RTN","SAMIUR",633,0)
 . i $g(@lroot@(ien,"siteid"))'[site q  ;
"RTN","SAMIUR",634,0)
 . ;quit:$get(@lroot@(ien,"remotedfn"))'=""  ;
"RTN","SAMIUR",635,0)
 . ;
"RTN","SAMIUR",636,0)
 . merge SAMIPATS(ien,dfn)=@lroot@(ien)
"RTN","SAMIUR",637,0)
 . ;
"RTN","SAMIUR",638,0)
 . new name set name=$get(SAMIPATS(ien,dfn,"saminame"))
"RTN","SAMIUR",639,0)
 . ; new name set name=$get(SAMIPATS(ien,dfn,"sinamef"))
"RTN","SAMIUR",640,0)
 . ; set name=name_","_SAMIPATS(ien,dfn,"sinamel")
"RTN","SAMIUR",641,0)
 . new nuhref set nuhref="<form method=POST action=""/vapals"">"
"RTN","SAMIUR",642,0)
 . set nuhref=nuhref_"<input type=hidden name=""samiroute"" value=""editperson"">"
"RTN","SAMIUR",643,0)
 . set nuhref=nuhref_"<input type=hidden name=""dfn"" value="_dfn_">"
"RTN","SAMIUR",644,0)
 . set nuhref=nuhref_"<input type=hidden name=""siteid"" value="_site_">"
"RTN","SAMIUR",645,0)
 . set nuhref=nuhref_"<input value="""_name_""" class=""btn btn-link"" role=""link"" type=""submit""></form>"
"RTN","SAMIUR",646,0)
 . set SAMIPATS(ien,dfn,"editref")=nuhref
"RTN","SAMIUR",647,0)
 . quit
"RTN","SAMIUR",648,0)
 ;
"RTN","SAMIUR",649,0)
 quit  ; end of UNMAT
"RTN","SAMIUR",650,0)
 ;
"RTN","SAMIUR",651,0)
 ;
"RTN","SAMIUR",652,0)
 ;
"RTN","SAMIUR",653,0)
WKLIST(SAMIPATS,ztype,datephrase,filter) ; build work list
"RTN","SAMIUR",654,0)
 ;
"RTN","SAMIUR",655,0)
 ;@called-by
"RTN","SAMIUR",656,0)
 ; SELECT
"RTN","SAMIUR",657,0)
 ;@calls
"RTN","SAMIUR",658,0)
 ; $$setroot^%wd
"RTN","SAMIUR",659,0)
 ;
"RTN","SAMIUR",660,0)
 ; add site
"RTN","SAMIUR",661,0)
 ; add compare to vapals-patients
"RTN","SAMIUR",662,0)
 ; add navigation to enrollment
"RTN","SAMIUR",663,0)
 ;
"RTN","SAMIUR",664,0)
 kill ^gpl("worklist")
"RTN","SAMIUR",665,0)
 merge ^gpl("worklist")=filter
"RTN","SAMIUR",666,0)
 new site
"RTN","SAMIUR",667,0)
 set site=$get(filter("siteid"))
"RTN","SAMIUR",668,0)
 quit:site=""
"RTN","SAMIUR",669,0)
 set datephrase="Work List"
"RTN","SAMIUR",670,0)
 new lroot set lroot=$$setroot^%wd("patient-lookup")
"RTN","SAMIUR",671,0)
 new proot set proot=$$setroot^%wd("vapals-patients")
"RTN","SAMIUR",672,0)
 ;
"RTN","SAMIUR",673,0)
 new dfn set dfn=0
"RTN","SAMIUR",674,0)
 for  set dfn=$order(@lroot@("dfn",dfn)) quit:+dfn=0  do  ;
"RTN","SAMIUR",675,0)
 . quit:$order(@proot@("dfn",dfn,""))'=""
"RTN","SAMIUR",676,0)
 . new ien set ien=$order(@lroot@("dfn",dfn,""))
"RTN","SAMIUR",677,0)
 . quit:ien=""
"RTN","SAMIUR",678,0)
 . ;
"RTN","SAMIUR",679,0)
 . ; write !,"dfn= ",dfn
"RTN","SAMIUR",680,0)
 . ; zwrite @lroot@(ien,*)
"RTN","SAMIUR",681,0)
 . ;
"RTN","SAMIUR",682,0)
 . quit:$get(@lroot@(ien,"siteid"))'=site
"RTN","SAMIUR",683,0)
 . ;
"RTN","SAMIUR",684,0)
 . merge ^gpl("worklist","lroot",ien)=@lroot@(ien)
"RTN","SAMIUR",685,0)
 . merge SAMIPATS(ien,dfn)=@lroot@(ien)
"RTN","SAMIUR",686,0)
 . new name set name=$get(SAMIPATS(ien,dfn,"saminame"))
"RTN","SAMIUR",687,0)
 . ; new name set name=$get(SAMIPATS(ien,dfn,"sinamef"))
"RTN","SAMIUR",688,0)
 . ; set name=name_","_SAMIPATS(ien,dfn,"sinamel")
"RTN","SAMIUR",689,0)
 . new nuhref
"RTN","SAMIUR",690,0)
 . set nuhref="<td data-search="""_name_""" data-order="""_name_""">"
"RTN","SAMIUR",691,0)
 . set nuhref=nuhref_"<form method=POST action=""/vapals"">"
"RTN","SAMIUR",692,0)
 . set nuhref=nuhref_"<input type=hidden name=""samiroute"" value=""newcase"">"
"RTN","SAMIUR",693,0)
 . set nuhref=nuhref_"<input type=hidden name=""dfn"" value="_dfn_">"
"RTN","SAMIUR",694,0)
 . set nuhref=nuhref_"<input type=hidden name=""siteid"" value="_site_">"
"RTN","SAMIUR",695,0)
 . set nuhref=nuhref_"<input value="""_name_""" class=""btn btn-link"" role=""link"" type=""submit""></form>"
"RTN","SAMIUR",696,0)
 . set nuhref=nuhref_"</td>"
"RTN","SAMIUR",697,0)
 . set SAMIPATS(ien,dfn,"workref")=nuhref
"RTN","SAMIUR",698,0)
 . quit
"RTN","SAMIUR",699,0)
 ;
"RTN","SAMIUR",700,0)
 merge ^gpl("worklist","pats")=SAMIPATS
"RTN","SAMIUR",701,0)
 ;
"RTN","SAMIUR",702,0)
 quit  ; end of WKLIST
"RTN","SAMIUR",703,0)
 ;
"RTN","SAMIUR",704,0)
 ;
"RTN","SAMIUR",705,0)
 ;
"RTN","SAMIUR",706,0)
EOR ; end of SAMIUR
"RTN","SAMIUR2")
0^2^B1328996822
"RTN","SAMIUR2",1,0)
SAMIUR2 ;ven/gpl - user reports cont ;2021-09-10t01:30z
"RTN","SAMIUR2",2,0)
 ;;18.0;SAMI;**5,11,12,14**;2020-01;Build 4
"RTN","SAMIUR2",3,0)
 ;;18.14
"RTN","SAMIUR2",4,0)
 ;
"RTN","SAMIUR2",5,0)
 ; SAMIUR2 contains subroutines for creating & implementing the
"RTN","SAMIUR2",6,0)
 ; report-definition table.
"RTN","SAMIUR2",7,0)
 ;
"RTN","SAMIUR2",8,0)
 quit  ; no entry from top
"RTN","SAMIUR2",9,0)
 ;
"RTN","SAMIUR2",10,0)
 ;
"RTN","SAMIUR2",11,0)
 ;
"RTN","SAMIUR2",12,0)
 ;@section 0 primary development
"RTN","SAMIUR2",13,0)
 ;
"RTN","SAMIUR2",14,0)
 ;
"RTN","SAMIUR2",15,0)
 ;
"RTN","SAMIUR2",16,0)
 ;@routine-credits
"RTN","SAMIUR2",17,0)
 ;@dev-main George P. Lilly (gpl)
"RTN","SAMIUR2",18,0)
 ; gpl@vistaexpertise.net
"RTN","SAMIUR2",19,0)
 ;@dev-org-main Vista Expertise Network (ven)
"RTN","SAMIUR2",20,0)
 ; http://vistaexpertise.net
"RTN","SAMIUR2",21,0)
 ;@copyright 2017/2021, gpl, all rights reserved
"RTN","SAMIUR2",22,0)
 ;@license see routine SAMIUL
"RTN","SAMIUR2",23,0)
 ;
"RTN","SAMIUR2",24,0)
 ;@last-update 2021-09-10t01:30z
"RTN","SAMIUR2",25,0)
 ;@application Screening Applications Management (SAM)
"RTN","SAMIUR2",26,0)
 ;@module Screening Applications Management - IELCAP (SAMI)
"RTN","SAMIUR2",27,0)
 ;@suite-of-files SAMI Forms (311.101-311.199)
"RTN","SAMIUR2",28,0)
 ;@version 18.12
"RTN","SAMIUR2",29,0)
 ;@release-date 2020-01
"RTN","SAMIUR2",30,0)
 ;@patch-list **5,11,12**
"RTN","SAMIUR2",31,0)
 ;
"RTN","SAMIUR2",32,0)
 ;@dev-add Frederick D. S. Marshall (toad)
"RTN","SAMIUR2",33,0)
 ; toad@vistaexpertise.net
"RTN","SAMIUR2",34,0)
 ;@dev-add Larry G. Carlson (lgc)
"RTN","SAMIUR2",35,0)
 ; larry.g.carlson@gmail.com
"RTN","SAMIUR2",36,0)
 ;@dev-add Alexis R. Carlson (arc)
"RTN","SAMIUR2",37,0)
 ; whatisthehumanspirit@gmail.com
"RTN","SAMIUR2",38,0)
 ;@dev-add Kenneth McGlothlen (mcglk)
"RTN","SAMIUR2",39,0)
 ; mcglk@vistaexpertise.net
"RTN","SAMIUR2",40,0)
 ;
"RTN","SAMIUR2",41,0)
 ;@module-credits see SAMIHUL
"RTN","SAMIUR2",42,0)
 ;
"RTN","SAMIUR2",43,0)
 ;@module-log repo github.com:VA-PALS-ELCAP/SAMI-VAPALS-ELCAP.git
"RTN","SAMIUR2",44,0)
 ; see SAMIURUL
"RTN","SAMIUR2",45,0)
 ;
"RTN","SAMIUR2",46,0)
 ;@contents
"RTN","SAMIUR2",47,0)
 ; RPTTBL build report-definition table
"RTN","SAMIUR2",48,0)
 ;
"RTN","SAMIUR2",49,0)
 ; $$DFN2SID study id for patient DFN
"RTN","SAMIUR2",50,0)
 ; $$MKNAV html for navigation to form
"RTN","SAMIUR2",51,0)
 ;
"RTN","SAMIUR2",52,0)
 ; $$SHDET table contents for smoking history
"RTN","SAMIUR2",53,0)
 ; CUMPY forms array of cummulative pack year data
"RTN","SAMIUR2",54,0)
 ; $$TDDT embed date in table cell
"RTN","SAMIUR2",55,0)
 ; $$FMDT convert date to fileman format
"RTN","SAMIUR2",56,0)
 ; $$PKYDT pack-years from start & end & cigs/day
"RTN","SAMIUR2",57,0)
 ; $$PKY pack-years from years & packs/day
"RTN","SAMIUR2",58,0)
 ;
"RTN","SAMIUR2",59,0)
 ; $$AGE age
"RTN","SAMIUR2",60,0)
 ; $$BLINEDT baseline date
"RTN","SAMIUR2",61,0)
 ; $$CONTACT patient street address
"RTN","SAMIUR2",62,0)
 ; $$CTPROT ct protocol
"RTN","SAMIUR2",63,0)
 ; $$DOB date of birth
"RTN","SAMIUR2",64,0)
 ; $$FUDATE followup date
"RTN","SAMIUR2",65,0)
 ; $$GENDER gender
"RTN","SAMIUR2",66,0)
 ; $$IFORM name(s) of incomplete forms
"RTN","SAMIUR2",67,0)
 ; $$LASTEXM patient last exam
"RTN","SAMIUR2",68,0)
 ; $$MANPAT unmatched patient cell
"RTN","SAMIUR2",69,0)
 ; $$MATCH match button cell
"RTN","SAMIUR2",70,0)
 ; $$NAME name w/hyperlink
"RTN","SAMIUR2",71,0)
 ; $$PACKYRS smoking status
"RTN","SAMIUR2",72,0)
 ; $$POSSIBLE possible match cell
"RTN","SAMIUR2",73,0)
 ; $$RECOM recommendation
"RTN","SAMIUR2",74,0)
 ; $$RURAL patient's rural/urban status
"RTN","SAMIUR2",75,0)
 ; $$SID study id
"RTN","SAMIUR2",76,0)
 ; $$SMHIS smoking history cell
"RTN","SAMIUR2",77,0)
 ; $$SMKSTAT smoking status
"RTN","SAMIUR2",78,0)
 ; $$SSN social security number
"RTN","SAMIUR2",79,0)
 ; $$STUDYDT latest study date
"RTN","SAMIUR2",80,0)
 ; $$STUDYTYP latest study type
"RTN","SAMIUR2",81,0)
 ; $$VALS form-values cell
"RTN","SAMIUR2",82,0)
 ; $$WHEN followup text
"RTN","SAMIUR2",83,0)
 ; $$WORKPAT worklist patient name cell
"RTN","SAMIUR2",84,0)
 ;
"RTN","SAMIUR2",85,0)
 ; EPAT patient name w/nav to enrollment
"RTN","SAMIUR2",86,0)
 ; ETHNCTY ethnicity
"RTN","SAMIUR2",87,0)
 ; RACE race
"RTN","SAMIUR2",88,0)
 ; STATUS patient status
"RTN","SAMIUR2",89,0)
 ; WSVALS display form values from graph
"RTN","SAMIUR2",90,0)
 ;
"RTN","SAMIUR2",91,0)
 ;
"RTN","SAMIUR2",92,0)
 ;
"RTN","SAMIUR2",93,0)
 ;@section 1 ppi RPTTBL^SAMIUR2
"RTN","SAMIUR2",94,0)
 ;
"RTN","SAMIUR2",95,0)
 ;
"RTN","SAMIUR2",96,0)
 ;
"RTN","SAMIUR2",97,0)
RPTTBL(RPT,TYPE,SITE) ; RPT is passed by reference and returns the 
"RTN","SAMIUR2",98,0)
 ; report definition table. TYPE is the report type to be returned
"RTN","SAMIUR2",99,0)
 ; This routine could use a file or a graph in the next version
"RTN","SAMIUR2",100,0)
 ;
"RTN","SAMIUR2",101,0)
 ;;private;procedure;clean;silent;sac
"RTN","SAMIUR2",102,0)
 ;@called-by
"RTN","SAMIUR2",103,0)
 ; WSREPORT^SAMIUR
"RTN","SAMIUR2",104,0)
 ; WSREPORT^SAMIUR1 (which then calls WSREPORT^SAMIUR)
"RTN","SAMIUR2",105,0)
 ;@calls none (defines calls for WSREPORT^SAMIUR to call)
"RTN","SAMIUR2",106,0)
 ;@input
"RTN","SAMIUR2",107,0)
 ; TYPE = report type to return
"RTN","SAMIUR2",108,0)
 ;@output
"RTN","SAMIUR2",109,0)
 ; .RPT report-definition table
"RTN","SAMIUR2",110,0)
 ;
"RTN","SAMIUR2",111,0)
 ; This routine could use a file or a graph in the next version
"RTN","SAMIUR2",112,0)
 ;
"RTN","SAMIUR2",113,0)
 if TYPE="followup" do  quit  ;
"RTN","SAMIUR2",114,0)
 . set RPT(1,"header")="F/U Date"
"RTN","SAMIUR2",115,0)
 . set RPT(1,"routine")="$$FUDATE^SAMIUR2"
"RTN","SAMIUR2",116,0)
 . set RPT(2,"header")="Name"
"RTN","SAMIUR2",117,0)
 . set RPT(2,"routine")="$$NAME^SAMIUR2"
"RTN","SAMIUR2",118,0)
 . ;set RPT(3,"header")="SSN"
"RTN","SAMIUR2",119,0)
 . set RPT(3,"header")=$$SSNLABEL(SITE)
"RTN","SAMIUR2",120,0)
 . set RPT(3,"routine")="$$SSN^SAMIUR2"
"RTN","SAMIUR2",121,0)
 . set RPT(4,"header")="Baseline Date"
"RTN","SAMIUR2",122,0)
 . set RPT(4,"routine")="$$BLINEDT^SAMIUR2"
"RTN","SAMIUR2",123,0)
 . set RPT(5,"header")="Last Form"
"RTN","SAMIUR2",124,0)
 . set RPT(5,"routine")="$$AFORM^SAMIUR2"
"RTN","SAMIUR2",125,0)
 . set RPT(6,"header")="Form Date"
"RTN","SAMIUR2",126,0)
 . set RPT(6,"routine")="$$AFORMDT^SAMIUR2"
"RTN","SAMIUR2",127,0)
 . set RPT(7,"header")="Recommend"
"RTN","SAMIUR2",128,0)
 . set RPT(7,"routine")="$$RECOM^SAMIUR2"
"RTN","SAMIUR2",129,0)
 . set RPT(8,"header")="Contact Information"
"RTN","SAMIUR2",130,0)
 . set RPT(8,"routine")="$$CONTACT^SAMIUR2"
"RTN","SAMIUR2",131,0)
 . quit
"RTN","SAMIUR2",132,0)
 ;
"RTN","SAMIUR2",133,0)
 if TYPE="activity" do  quit  ;
"RTN","SAMIUR2",134,0)
 . set RPT(1,"header")="Name"
"RTN","SAMIUR2",135,0)
 . set RPT(1,"routine")="$$NAME^SAMIUR2"
"RTN","SAMIUR2",136,0)
 . set RPT(2,"header")=$$SSNLABEL(SITE)
"RTN","SAMIUR2",137,0)
 . set RPT(2,"routine")="$$SSN^SAMIUR2"
"RTN","SAMIUR2",138,0)
 . set RPT(2.5,"header")="Form"
"RTN","SAMIUR2",139,0)
 . set RPT(2.5,"routine")="$$AFORM^SAMIUR2"
"RTN","SAMIUR2",140,0)
 . set RPT(3,"header")="Form Date"
"RTN","SAMIUR2",141,0)
 . ;set RPT(3,"routine")="$$STUDYDT^SAMIUR2"
"RTN","SAMIUR2",142,0)
 . set RPT(3,"routine")="$$AFORMDT^SAMIUR2"
"RTN","SAMIUR2",143,0)
 . ;set RPT(4,"header")="Type"
"RTN","SAMIUR2",144,0)
 . ;set RPT(4,"routine")="$$STUDYTYP^SAMIUR2"
"RTN","SAMIUR2",145,0)
 . ;set RPT(5,"header")="CT Protocol"
"RTN","SAMIUR2",146,0)
 . ;set RPT(5,"routine")="$$CTPROT^SAMIUR2"
"RTN","SAMIUR2",147,0)
 . set RPT(6,"header")="Follow-up"
"RTN","SAMIUR2",148,0)
 . set RPT(6,"routine")="$$RECOM^SAMIUR2"
"RTN","SAMIUR2",149,0)
 . ;set RPT(7,"header")="When"
"RTN","SAMIUR2",150,0)
 . ;set RPT(7,"routine")="$$WHEN^SAMIUR2"
"RTN","SAMIUR2",151,0)
 . set RPT(8,"header")="on Date"
"RTN","SAMIUR2",152,0)
 . set RPT(8,"routine")="$$FUDATE^SAMIUR2"
"RTN","SAMIUR2",153,0)
 . quit
"RTN","SAMIUR2",154,0)
 ;
"RTN","SAMIUR2",155,0)
 if TYPE="enrollment" do  quit  ;
"RTN","SAMIUR2",156,0)
 . set RPT(1,"header")="Name"
"RTN","SAMIUR2",157,0)
 . set RPT(1,"routine")="$$NAME^SAMIUR2"
"RTN","SAMIUR2",158,0)
 . set RPT(1.5,"header")="Active/Inactive"
"RTN","SAMIUR2",159,0)
 . set RPT(1.5,"routine")="$$ACTIVE^SAMIUR2"
"RTN","SAMIUR2",160,0)
 . set RPT(2,"header")=$$SSNLABEL(SITE)
"RTN","SAMIUR2",161,0)
 . set RPT(2,"routine")="$$SSN^SAMIUR2"
"RTN","SAMIUR2",162,0)
 . set RPT(3,"header")="CT Date"
"RTN","SAMIUR2",163,0)
 . set RPT(3,"routine")="$$STUDYDT^SAMIUR2"
"RTN","SAMIUR2",164,0)
 . set RPT(4,"header")="Gender"
"RTN","SAMIUR2",165,0)
 . set RPT(4,"routine")="$$GENDER^SAMIUR2"
"RTN","SAMIUR2",166,0)
 . ; set RPT(5,"header")="Race"
"RTN","SAMIUR2",167,0)
 . ; set RPT(5,"routine")="$$RACE^SAMIUR2"
"RTN","SAMIUR2",168,0)
 . set RPT(6,"header")="Age"
"RTN","SAMIUR2",169,0)
 . set RPT(6,"routine")="$$AGE^SAMIUR2"
"RTN","SAMIUR2",170,0)
 . set RPT(7,"header")="Urban/Rural"
"RTN","SAMIUR2",171,0)
 . set RPT(7,"routine")="$$RURAL^SAMIUR2"
"RTN","SAMIUR2",172,0)
 . set RPT(8,"header")="Smoking Status"
"RTN","SAMIUR2",173,0)
 . set RPT(8,"routine")="$$SMKSTAT^SAMIUR2"
"RTN","SAMIUR2",174,0)
 . set RPT(9,"header")="Pack Years at Intake"
"RTN","SAMIUR2",175,0)
 . set RPT(9,"routine")="$$PACKYRS^SAMIUR2"
"RTN","SAMIUR2",176,0)
 . quit
"RTN","SAMIUR2",177,0)
 ;
"RTN","SAMIUR2",178,0)
 if TYPE="inactive" do  quit  ;
"RTN","SAMIUR2",179,0)
 . set RPT(1,"header")="Name"
"RTN","SAMIUR2",180,0)
 . set RPT(1,"routine")="$$NAME^SAMIUR2"
"RTN","SAMIUR2",181,0)
 . set RPT(2,"header")=$$SSNLABEL(SITE)
"RTN","SAMIUR2",182,0)
 . set RPT(2,"routine")="$$SSN^SAMIUR2"
"RTN","SAMIUR2",183,0)
 . set RPT(3,"header")="Enrollment date"
"RTN","SAMIUR2",184,0)
 . set RPT(3,"routine")="$$BLINEDT^SAMIUR2"
"RTN","SAMIUR2",185,0)
 . ;set RPT(3,"header")="CT Date"
"RTN","SAMIUR2",186,0)
 . ;set RPT(3,"routine")="$$STUDYDT^SAMIUR2"
"RTN","SAMIUR2",187,0)
 . ;set RPT(4,"header")="Gender"
"RTN","SAMIUR2",188,0)
 . ;set RPT(4,"routine")="$$GENDER^SAMIUR2"
"RTN","SAMIUR2",189,0)
 . ; set RPT(5,"header")="Race"
"RTN","SAMIUR2",190,0)
 . ; set RPT(5,"routine")="$$RACE^SAMIUR2"
"RTN","SAMIUR2",191,0)
 . ;set RPT(6,"header")="Age"
"RTN","SAMIUR2",192,0)
 . ;set RPT(6,"routine")="$$AGE^SAMIUR2"
"RTN","SAMIUR2",193,0)
 . set RPT(4,"header")="Date of Death"
"RTN","SAMIUR2",194,0)
 . set RPT(4,"routine")="$$INACTDT^SAMIUR2"
"RTN","SAMIUR2",195,0)
 . set RPT(5,"header")="Inactive Reason"
"RTN","SAMIUR2",196,0)
 . set RPT(5,"routine")="$$INACTRE^SAMIUR2"
"RTN","SAMIUR2",197,0)
 . set RPT(6,"header")="Inactive Comment"
"RTN","SAMIUR2",198,0)
 . set RPT(6,"routine")="$$INACTCM^SAMIUR2"
"RTN","SAMIUR2",199,0)
 . ;set RPT(7,"header")="Urban/Rural"
"RTN","SAMIUR2",200,0)
 . ;set RPT(7,"routine")="$$RURAL^SAMIUR2"
"RTN","SAMIUR2",201,0)
 . ;set RPT(8,"header")="Smoking Status"
"RTN","SAMIUR2",202,0)
 . ;set RPT(8,"routine")="$$SMKSTAT^SAMIUR2"
"RTN","SAMIUR2",203,0)
 . ;set RPT(9,"header")="Pack Years at Intake"
"RTN","SAMIUR2",204,0)
 . ;set RPT(9,"routine")="$$PACKYRS^SAMIUR2"
"RTN","SAMIUR2",205,0)
 . quit
"RTN","SAMIUR2",206,0)
 ;
"RTN","SAMIUR2",207,0)
 if TYPE="incomplete" do  quit  ;
"RTN","SAMIUR2",208,0)
 . set RPT(1,"header")="Enrollment date"
"RTN","SAMIUR2",209,0)
 . set RPT(1,"routine")="$$BLINEDT^SAMIUR2"
"RTN","SAMIUR2",210,0)
 . set RPT(2,"header")="Name"
"RTN","SAMIUR2",211,0)
 . set RPT(2,"routine")="$$NAME^SAMIUR2"
"RTN","SAMIUR2",212,0)
 . set RPT(3,"header")=$$SSNLABEL(SITE)
"RTN","SAMIUR2",213,0)
 . set RPT(3,"routine")="$$SSN^SAMIUR2"
"RTN","SAMIUR2",214,0)
 . set RPT(4,"header")="Incomplete form"
"RTN","SAMIUR2",215,0)
 . set RPT(4,"routine")="$$IFORM^SAMIUR2"
"RTN","SAMIUR2",216,0)
 . quit
"RTN","SAMIUR2",217,0)
 ;
"RTN","SAMIUR2",218,0)
 if TYPE="missingct" do  quit  ;
"RTN","SAMIUR2",219,0)
 . set RPT(1,"header")="Last contact date"
"RTN","SAMIUR2",220,0)
 . set RPT(1,"routine")="$$LDOC^SAMIUR2"
"RTN","SAMIUR2",221,0)
 . set RPT(2,"header")="Last contact entry"
"RTN","SAMIUR2",222,0)
 . set RPT(2,"routine")="$$LENTRY^SAMIUR2"
"RTN","SAMIUR2",223,0)
 . set RPT(3,"header")="Name"
"RTN","SAMIUR2",224,0)
 . set RPT(3,"routine")="$$NAME^SAMIUR2"
"RTN","SAMIUR2",225,0)
 . set RPT(4,"header")=$$SSNLABEL(SITE)
"RTN","SAMIUR2",226,0)
 . set RPT(4,"routine")="$$SSN^SAMIUR2"
"RTN","SAMIUR2",227,0)
 . set RPT(5,"header")="Enrollment date"
"RTN","SAMIUR2",228,0)
 . set RPT(5,"routine")="$$BLINEDT^SAMIUR2"
"RTN","SAMIUR2",229,0)
 . quit
"RTN","SAMIUR2",230,0)
 ;
"RTN","SAMIUR2",231,0)
 if TYPE="cumpy" do  quit  ;
"RTN","SAMIUR2",232,0)
 . set RPT(1,"header")="Name"
"RTN","SAMIUR2",233,0)
 . set RPT(1,"routine")="$$NAME^SAMIUR2"
"RTN","SAMIUR2",234,0)
 . set RPT(2,"header")="Study ID"
"RTN","SAMIUR2",235,0)
 . set RPT(2,"routine")="$$SID^SAMIUR2"
"RTN","SAMIUR2",236,0)
 . set RPT(3,"header")="Form Values"
"RTN","SAMIUR2",237,0)
 . set RPT(3,"routine")="$$VALS^SAMIUR2"
"RTN","SAMIUR2",238,0)
 . set RPT(4,"header")="Smoking History"
"RTN","SAMIUR2",239,0)
 . set RPT(4,"routine")="$$SMHIS^SAMIUR2"
"RTN","SAMIUR2",240,0)
 . quit
"RTN","SAMIUR2",241,0)
 ;
"RTN","SAMIUR2",242,0)
 if TYPE="unmatched" do  ;
"RTN","SAMIUR2",243,0)
 . set RPT(1,"header")="Unmatched Manual Entry"
"RTN","SAMIUR2",244,0)
 . set RPT(1,"routine")="$$MANPAT^SAMIUR2"
"RTN","SAMIUR2",245,0)
 . set RPT(2,"header")="Possible HL7 Match"
"RTN","SAMIUR2",246,0)
 . set RPT(2,"routine")="$$POSSIBLE^SAMIUR2"
"RTN","SAMIUR2",247,0)
 . set RPT(3,"header")="Match Control"
"RTN","SAMIUR2",248,0)
 . set RPT(3,"routine")="$$MATCH^SAMIUR2"
"RTN","SAMIUR2",249,0)
 . quit
"RTN","SAMIUR2",250,0)
 ;
"RTN","SAMIUR2",251,0)
 if TYPE="worklist" do  quit  ;
"RTN","SAMIUR2",252,0)
 . set RPT(1,"header")="Name"
"RTN","SAMIUR2",253,0)
 . set RPT(1,"routine")="$$WORKPAT^SAMIUR2"
"RTN","SAMIUR2",254,0)
 . set RPT(2,"header")=$$SSNLABEL(SITE)
"RTN","SAMIUR2",255,0)
 . set RPT(2,"routine")="$$SSN^SAMIUR2"
"RTN","SAMIUR2",256,0)
 . set RPT(3,"header")="Date of birth"
"RTN","SAMIUR2",257,0)
 . set RPT(3,"routine")="$$DOB^SAMIUR2"
"RTN","SAMIUR2",258,0)
 . set RPT(4,"header")="Gender"
"RTN","SAMIUR2",259,0)
 . set RPT(4,"routine")="$$GENDER^SAMIUR2"
"RTN","SAMIUR2",260,0)
 . quit
"RTN","SAMIUR2",261,0)
 ;
"RTN","SAMIUR2",262,0)
 quit  ; end of ppi RPTTBL^SAMIUR2
"RTN","SAMIUR2",263,0)
 ;
"RTN","SAMIUR2",264,0)
 ;
"RTN","SAMIUR2",265,0)
 ;
"RTN","SAMIUR2",266,0)
 ;@section 2 shared subroutines
"RTN","SAMIUR2",267,0)
 ;
"RTN","SAMIUR2",268,0)
 ;
"RTN","SAMIUR2",269,0)
 ;
"RTN","SAMIUR2",270,0)
DFN2SID(DFN) ;studyid for patient DFN
"RTN","SAMIUR2",271,0)
 ;
"RTN","SAMIUR2",272,0)
 ;;private;function;clean;silent;sac
"RTN","SAMIUR2",273,0)
 ;@called-by
"RTN","SAMIUR2",274,0)
 ; $$SID^SAMIUR2
"RTN","SAMIUR2",275,0)
 ; $$IFORM^SAMIUR2
"RTN","SAMIUR2",276,0)
 ; $$VALS^SAMIUR2
"RTN","SAMIUR2",277,0)
 ; $$SMHIS^SAMIUR2
"RTN","SAMIUR2",278,0)
 ;@calls
"RTN","SAMIUR2",279,0)
 ; $$setroot^%wd
"RTN","SAMIUR2",280,0)
 ;
"RTN","SAMIUR2",281,0)
 new root set root=$$setroot^%wd("vapals-patients")
"RTN","SAMIUR2",282,0)
 ;
"RTN","SAMIUR2",283,0)
 quit $get(@root@(DFN,"sisid")) ; end of $$DFN2SID
"RTN","SAMIUR2",284,0)
 ;
"RTN","SAMIUR2",285,0)
 ;
"RTN","SAMIUR2",286,0)
 ;
"RTN","SAMIUR2",287,0)
MKNAV(sid,zform,fname,form) ; html for navigation to form
"RTN","SAMIUR2",288,0)
 ;
"RTN","SAMIUR2",289,0)
 ;;private;function;clean;silent;sac
"RTN","SAMIUR2",290,0)
 ;@called-by
"RTN","SAMIUR2",291,0)
 ; $$IFORM^SAMIUR2
"RTN","SAMIUR2",292,0)
 ;@calls none
"RTN","SAMIUR2",293,0)
 ;
"RTN","SAMIUR2",294,0)
 new rtn set rtn="<form method=""post"" action=""/vapals"">"
"RTN","SAMIUR2",295,0)
 set rtn=rtn_"<input name=""samiroute"" value=""form"" type=""hidden"">"
"RTN","SAMIUR2",296,0)
 set rtn=rtn_" <input name=""studyid"" value="""_sid_""" type=""hidden"">"
"RTN","SAMIUR2",297,0)
 set rtn=rtn_" <input name=""form"" value=""vapals:"_zform_""" type=""hidden"">"
"RTN","SAMIUR2",298,0)
 set rtn=rtn_" <input value="""_fname_""" class=""btn btn-link"" role=""link"" type=""submit""></form>"_$char(13)
"RTN","SAMIUR2",299,0)
 ;
"RTN","SAMIUR2",300,0)
 quit rtn ; end of $$MKNAV
"RTN","SAMIUR2",301,0)
 ;
"RTN","SAMIUR2",302,0)
 ;
"RTN","SAMIUR2",303,0)
 ;
"RTN","SAMIUR2",304,0)
 ;@section 3 smoking history subroutines
"RTN","SAMIUR2",305,0)
 ;
"RTN","SAMIUR2",306,0)
 ;
"RTN","SAMIUR2",307,0)
 ;
"RTN","SAMIUR2",308,0)
SHDET(SID,KEY) ; table contents for smoking history
"RTN","SAMIUR2",309,0)
 ;
"RTN","SAMIUR2",310,0)
 ;;ppi;function;clean;silent;sac
"RTN","SAMIUR2",311,0)
 ;@called-by
"RTN","SAMIUR2",312,0)
 ; LOAD^SAMIFLD
"RTN","SAMIUR2",313,0)
 ; $$SMHIS^SAMIUR2
"RTN","SAMIUR2",314,0)
 ;@calls
"RTN","SAMIUR2",315,0)
 ; CUMPY
"RTN","SAMIUR2",316,0)
 ;
"RTN","SAMIUR2",317,0)
 ; KEY is the form key of the caller for "current" marker insertion
"RTN","SAMIUR2",318,0)
 ;
"RTN","SAMIUR2",319,0)
 new pyary
"RTN","SAMIUR2",320,0)
 if $get(KEY)="" set KEY=""
"RTN","SAMIUR2",321,0)
 do CUMPY("pyary",SID,KEY)
"RTN","SAMIUR2",322,0)
 ;
"RTN","SAMIUR2",323,0)
 new current set current=$get(pyary("current"))
"RTN","SAMIUR2",324,0)
 new rptcnt set rptcnt=0
"RTN","SAMIUR2",325,0)
 new rptmax set rptmax=$order(pyary("rpt",""),-1)
"RTN","SAMIUR2",326,0)
 quit:+rptmax=0
"RTN","SAMIUR2",327,0)
 ;
"RTN","SAMIUR2",328,0)
 new return set return=""
"RTN","SAMIUR2",329,0)
 new zi set zi=""
"RTN","SAMIUR2",330,0)
 for zi=1:1:rptmax do  ;
"RTN","SAMIUR2",331,0)
 . set rptcnt=rptcnt+1
"RTN","SAMIUR2",332,0)
 . if rptcnt=current set return=return_"<tr data-current-form=""true"">"
"RTN","SAMIUR2",333,0)
 . else  set return=return_"<tr>"
"RTN","SAMIUR2",334,0)
 . set return=return_"<td>"_pyary("rpt",rptcnt,1)_"</td>"
"RTN","SAMIUR2",335,0)
 . set return=return_"<td class=""reported-date"">"_pyary("rpt",rptcnt,2)_"</td>"
"RTN","SAMIUR2",336,0)
 . set return=return_"<td class=""pack-years"">"_pyary("rpt",rptcnt,3)_"</td>"
"RTN","SAMIUR2",337,0)
 . set return=return_"<td class=""cumulative-pack-years"">"_pyary("rpt",rptcnt,4)_"</td>"
"RTN","SAMIUR2",338,0)
 . set return=return_"</tr>"
"RTN","SAMIUR2",339,0)
 . quit
"RTN","SAMIUR2",340,0)
 ;
"RTN","SAMIUR2",341,0)
 quit return ; end of ppi $$SHDET^SAMIUR2
"RTN","SAMIUR2",342,0)
 ;
"RTN","SAMIUR2",343,0)
 ;
"RTN","SAMIUR2",344,0)
 ;
"RTN","SAMIUR2",345,0)
CUMPY(PYARY,sid,KEY) ; forms array of cummulative pack year data
"RTN","SAMIUR2",346,0)
 ;
"RTN","SAMIUR2",347,0)
 ;;ppi;procedure;clean;silent;sac
"RTN","SAMIUR2",348,0)
 ;@called-by
"RTN","SAMIUR2",349,0)
 ; SSTATUS^SAMINOT2
"RTN","SAMIUR2",350,0)
 ; SSTATUS^SAMINOT3
"RTN","SAMIUR2",351,0)
 ; $$SHDET
"RTN","SAMIUR2",352,0)
 ;@calls
"RTN","SAMIUR2",353,0)
 ; $$setroot^%wd
"RTN","SAMIUR2",354,0)
 ; GETITEMS^SAMICASE
"RTN","SAMIUR2",355,0)
 ; $$GETDTKEY^SAMICAS2
"RTN","SAMIUR2",356,0)
 ; $$KEY2DSPD^SAMICAS2
"RTN","SAMIUR2",357,0)
 ; $$FMDT
"RTN","SAMIUR2",358,0)
 ; $$PKYDT
"RTN","SAMIUR2",359,0)
 ;
"RTN","SAMIUR2",360,0)
 ; PYARY passed by name
"RTN","SAMIUR2",361,0)
 ; KEY is the current form key for matching to a row
"RTN","SAMIUR2",362,0)
 ;
"RTN","SAMIUR2",363,0)
 kill @PYARY
"RTN","SAMIUR2",364,0)
 new root set root=$$setroot^%wd("vapals-patients")
"RTN","SAMIUR2",365,0)
 ; new sid set sid=$get(@root@(DFN,"samistudyid"))
"RTN","SAMIUR2",366,0)
 ; quit:sid=""
"RTN","SAMIUR2",367,0)
 ;
"RTN","SAMIUR2",368,0)
 new items set items=""
"RTN","SAMIUR2",369,0)
 do GETITEMS^SAMICASE("items",sid)
"RTN","SAMIUR2",370,0)
 quit:'$data(items)
"RTN","SAMIUR2",371,0)
 merge @PYARY@("items")=items
"RTN","SAMIUR2",372,0)
 ;
"RTN","SAMIUR2",373,0)
 new siform set siform=$order(items("siform"))
"RTN","SAMIUR2",374,0)
 quit:siform=""
"RTN","SAMIUR2",375,0)
 if siform=$get(KEY) set @PYARY@("current")=1 ;this row is the current form
"RTN","SAMIUR2",376,0)
 ;
"RTN","SAMIUR2",377,0)
 set @PYARY@("rpt",1,1)="Intake" ; Form
"RTN","SAMIUR2",378,0)
 new kdate set kdate=$$GETDTKEY^SAMICAS2(siform)
"RTN","SAMIUR2",379,0)
 new keydate set keydate=$$KEY2DSPD^SAMICAS2(kdate)
"RTN","SAMIUR2",380,0)
 set @PYARY@("rpt",1,2)=keydate ; Reported Date
"RTN","SAMIUR2",381,0)
 ;
"RTN","SAMIUR2",382,0)
 new vals set vals=$name(@root@("graph",sid,siform))
"RTN","SAMIUR2",383,0)
 new lastcum set lastcum=$get(@vals@("sippy"))
"RTN","SAMIUR2",384,0)
 set @PYARY@("rpt",1,3)=lastcum ; Pack Years
"RTN","SAMIUR2",385,0)
 set @PYARY@("rpt",1,4)=lastcum ; Cumulative
"RTN","SAMIUR2",386,0)
 ;
"RTN","SAMIUR2",387,0)
 new lastdt set lastdt=keydate
"RTN","SAMIUR2",388,0)
 new rptcnt set rptcnt=1
"RTN","SAMIUR2",389,0)
 new zi set zi=""
"RTN","SAMIUR2",390,0)
 for  do  quit:zi=""  ;
"RTN","SAMIUR2",391,0)
 . set zi=$order(items("type","vapals:fuform",zi))
"RTN","SAMIUR2",392,0)
 . quit:zi=""
"RTN","SAMIUR2",393,0)
 . ;
"RTN","SAMIUR2",394,0)
 . set rptcnt=rptcnt+1
"RTN","SAMIUR2",395,0)
 . set @PYARY@("rpt",rptcnt,1)="Follow-up"
"RTN","SAMIUR2",396,0)
 . new kdate set kdate=$$GETDTKEY^SAMICAS2(zi)
"RTN","SAMIUR2",397,0)
 . new keydate set keydate=$$KEY2DSPD^SAMICAS2(kdate)
"RTN","SAMIUR2",398,0)
 . set @PYARY@("rpt",rptcnt,2)=keydate ; Reported Date
"RTN","SAMIUR2",399,0)
 . ;
"RTN","SAMIUR2",400,0)
 . set vals=$name(@root@("graph",sid,zi))
"RTN","SAMIUR2",401,0)
 . new newpd set newpd=$g(@vals@("sippd"))
"RTN","SAMIUR2",402,0)
 . new usedate set usedate=keydate
"RTN","SAMIUR2",403,0)
 . new siq set siq=$get(@vals@("siq")) ; quit date on followup form
"RTN","SAMIUR2",404,0)
 . if siq'="" do  ; quit date provided
"RTN","SAMIUR2",405,0)
 . . quit:$$FMDT(siq)<$$FMDT(lastdt)  ; quit date out of range
"RTN","SAMIUR2",406,0)
 . . quit:$$FMDT(siq)>$$FMDT(keydate)  ; quit date out of range
"RTN","SAMIUR2",407,0)
 . . set usedate=siq ; use the quit date as end of range
"RTN","SAMIUR2",408,0)
 . . quit
"RTN","SAMIUR2",409,0)
 . new newpy set newpy=$$PKYDT(lastdt,usedate,newpd)
"RTN","SAMIUR2",410,0)
 . set @vals@("sippy")=newpy
"RTN","SAMIUR2",411,0)
 . ;
"RTN","SAMIUR2",412,0)
 . set ^gpl("current","KEY")=$get(KEY)
"RTN","SAMIUR2",413,0)
 . set ^gpl("current","zi")=zi
"RTN","SAMIUR2",414,0)
 . if zi=$get(KEY) do
"RTN","SAMIUR2",415,0)
 . . set @PYARY@("current")=rptcnt ;this row is the current form
"RTN","SAMIUR2",416,0)
 . . quit
"RTN","SAMIUR2",417,0)
 . ;
"RTN","SAMIUR2",418,0)
 . new newcum set newcum=""
"RTN","SAMIUR2",419,0)
 . if newpy'="" set newcum=lastcum+newpy
"RTN","SAMIUR2",420,0)
 . set @PYARY@("rpt",rptcnt,3)=newpy ; Pack Years
"RTN","SAMIUR2",421,0)
 . set @PYARY@("rpt",rptcnt,4)=newcum ; Cumulative
"RTN","SAMIUR2",422,0)
 . set lastdt=keydate
"RTN","SAMIUR2",423,0)
 . set lastcum=newcum
"RTN","SAMIUR2",424,0)
 . quit
"RTN","SAMIUR2",425,0)
 ;
"RTN","SAMIUR2",426,0)
 quit  ; end of ppi CUMPY^SAMIUR2
"RTN","SAMIUR2",427,0)
 ;
"RTN","SAMIUR2",428,0)
 ;
"RTN","SAMIUR2",429,0)
 ;
"RTN","SAMIUR2",430,0)
TDDT(ZDT) ; embed date in table cell
"RTN","SAMIUR2",431,0)
 ;
"RTN","SAMIUR2",432,0)
 ;;ppi;function;clean;silent;sac
"RTN","SAMIUR2",433,0)
 ;@called-by
"RTN","SAMIUR2",434,0)
 ; BLINEDT
"RTN","SAMIUR2",435,0)
 ; DOB
"RTN","SAMIUR2",436,0)
 ; FUDATE
"RTN","SAMIUR2",437,0)
 ; LASTEXM
"RTN","SAMIUR2",438,0)
 ; INACTDT
"RTN","SAMIUR2",439,0)
 ; LDOC
"RTN","SAMIUR2",440,0)
 ; STUDYDT
"RTN","SAMIUR2",441,0)
 ;@calls
"RTN","SAMIUR2",442,0)
 ; ^%DT
"RTN","SAMIUR2",443,0)
 ;
"RTN","SAMIUR2",444,0)
 new X,Y
"RTN","SAMIUR2",445,0)
 set X=ZDT
"RTN","SAMIUR2",446,0)
 do ^%DT
"RTN","SAMIUR2",447,0)
 if Y=-1 set Y=""
"RTN","SAMIUR2",448,0)
 new cell
"RTN","SAMIUR2",449,0)
 set cell="<td data-order="""_Y_""" data-search="""_ZDT_""">"_ZDT_"</td>"
"RTN","SAMIUR2",450,0)
 ;
"RTN","SAMIUR2",451,0)
 quit cell ; end of $$TDDT
"RTN","SAMIUR2",452,0)
 ; 
"RTN","SAMIUR2",453,0)
 ;
"RTN","SAMIUR2",454,0)
 ;
"RTN","SAMIUR2",455,0)
FMDT(ZDT) ; convert date to fileman format
"RTN","SAMIUR2",456,0)
 ;
"RTN","SAMIUR2",457,0)
 ;;ppi;function;clean;silent;sac
"RTN","SAMIUR2",458,0)
 ;@called-by
"RTN","SAMIUR2",459,0)
 ; MKPTLK^SAMIHOM4
"RTN","SAMIUR2",460,0)
 ; $$PKYDT
"RTN","SAMIUR2",461,0)
 ; CUMPY
"RTN","SAMIUR2",462,0)
 ;@calls
"RTN","SAMIUR2",463,0)
 ; ^%DT
"RTN","SAMIUR2",464,0)
 ;
"RTN","SAMIUR2",465,0)
 new Y
"RTN","SAMIUR2",466,0)
 new X set X=ZDT
"RTN","SAMIUR2",467,0)
 do ^%DT
"RTN","SAMIUR2",468,0)
 ;
"RTN","SAMIUR2",469,0)
 quit Y ; end of ppi $$FMDT^SAMIUR2
"RTN","SAMIUR2",470,0)
 ;
"RTN","SAMIUR2",471,0)
 ;
"RTN","SAMIUR2",472,0)
 ;
"RTN","SAMIUR2",473,0)
PKYDT(STDT,ENDT,PKS,CIGS) ; pack-years from start & end & cigs/day
"RTN","SAMIUR2",474,0)
 ;
"RTN","SAMIUR2",475,0)
 ;;private;function;clean;silent;sac
"RTN","SAMIUR2",476,0)
 ;@called-by
"RTN","SAMIUR2",477,0)
 ; CUMPY
"RTN","SAMIUR2",478,0)
 ;@calls
"RTN","SAMIUR2",479,0)
 ; $$FMDT
"RTN","SAMIUR2",480,0)
 ; $$FMDIFF^XLFDT
"RTN","SAMIUR2",481,0)
 ; $$PKY
"RTN","SAMIUR2",482,0)
 ;
"RTN","SAMIUR2",483,0)
 ; if PKS is not provided, 20/CIGS will be used for packs per day
"RTN","SAMIUR2",484,0)
 ;
"RTN","SAMIUR2",485,0)
 new pkyr set pkyr=""
"RTN","SAMIUR2",486,0)
 if $get(PKS)="" do  ;
"RTN","SAMIUR2",487,0)
 . if $get(CIGS)="" set PKS=0 quit  ;
"RTN","SAMIUR2",488,0)
 . set PKS=20/CIGS
"RTN","SAMIUR2",489,0)
 . quit
"RTN","SAMIUR2",490,0)
 new zst set zst=$$FMDT(STDT)
"RTN","SAMIUR2",491,0)
 set:zst=-1 zst=STDT
"RTN","SAMIUR2",492,0)
 ;
"RTN","SAMIUR2",493,0)
 new zend set zend=$$FMDT(ENDT)
"RTN","SAMIUR2",494,0)
 set:zend=-1 zend=ENDT ; probably a fileman date already
"RTN","SAMIUR2",495,0)
 ;
"RTN","SAMIUR2",496,0)
 new zdif set zdif=$$FMDIFF^XLFDT(zend,zst)/365.24
"RTN","SAMIUR2",497,0)
 ;
"RTN","SAMIUR2",498,0)
 set pkyr=$$PKY(zdif,PKS)
"RTN","SAMIUR2",499,0)
 ;
"RTN","SAMIUR2",500,0)
 quit pkyr ; end of $$PKYDT
"RTN","SAMIUR2",501,0)
 ;
"RTN","SAMIUR2",502,0)
 ;
"RTN","SAMIUR2",503,0)
 ;
"RTN","SAMIUR2",504,0)
PKY(YRS,PKS) ; pack-years from years & packs/day
"RTN","SAMIUR2",505,0)
 ;
"RTN","SAMIUR2",506,0)
 ;;private;function;clean;silent;sac
"RTN","SAMIUR2",507,0)
 ;@called-by
"RTN","SAMIUR2",508,0)
 ; $$PKYDT
"RTN","SAMIUR2",509,0)
 ;@calls none
"RTN","SAMIUR2",510,0)
 ;@input
"RTN","SAMIUR2",511,0)
 ; YRS = years
"RTN","SAMIUR2",512,0)
 ; PKS = packs/day
"RTN","SAMIUR2",513,0)
 ;
"RTN","SAMIUR2",514,0)
 new rtn set rtn=""
"RTN","SAMIUR2",515,0)
 set rtn=YRS*PKS
"RTN","SAMIUR2",516,0)
 if $length($piece(rtn,".",2))>2 do  ;
"RTN","SAMIUR2",517,0)
 . new zdec set zdec=$piece(rtn,".",2)
"RTN","SAMIUR2",518,0)
 . set rtn=$piece(rtn,".",1)_"."_$extract(zdec,1,2)
"RTN","SAMIUR2",519,0)
 . if $extract(zdec,3)>4 set rtn=rtn+.01
"RTN","SAMIUR2",520,0)
 . quit
"RTN","SAMIUR2",521,0)
 set:rtn'["." rtn=rtn_".0"
"RTN","SAMIUR2",522,0)
 ;
"RTN","SAMIUR2",523,0)
 quit rtn ; end of $$PKY
"RTN","SAMIUR2",524,0)
 ;
"RTN","SAMIUR2",525,0)
 ;
"RTN","SAMIUR2",526,0)
 ;
"RTN","SAMIUR2",527,0)
 ;@section 4 active column ppis
"RTN","SAMIUR2",528,0)
 ;
"RTN","SAMIUR2",529,0)
 ;
"RTN","SAMIUR2",530,0)
 ;
"RTN","SAMIUR2",531,0)
ACTIVE(zdt,dfn,SAMIPATS) ; Active/Inactive column
"RTN","SAMIUR2",532,0)
 ;
"RTN","SAMIUR2",533,0)
 new root set root=$$setroot^%wd("vapals-patients")
"RTN","SAMIUR2",534,0)
 new sid set sid=$get(@root@(dfn,"samistudyid"))
"RTN","SAMIUR2",535,0)
 new siform set siform=$get(SAMIPATS(zdt,dfn,"siform"))
"RTN","SAMIUR2",536,0)
 new vals set vals=$name(@root@("graph",sid,siform))
"RTN","SAMIUR2",537,0)
 new active set active="inactive"
"RTN","SAMIUR2",538,0)
 if $get(@vals@("sistatus"))="active" set active="active"
"RTN","SAMIUR2",539,0)
 ;
"RTN","SAMIUR2",540,0)
 quit active
"RTN","SAMIUR2",541,0)
 ; 
"RTN","SAMIUR2",542,0)
AFORM(zdt,dfn,SAMIPATS) ; Name of most recent form
"RTN","SAMIUR2",543,0)
 Q $GET(SAMIPATS(zdt,dfn,"aform"))
"RTN","SAMIUR2",544,0)
 ;
"RTN","SAMIUR2",545,0)
AFORMDT(zdt,dfn,SAMIPATS) ; Date of most recent form
"RTN","SAMIUR2",546,0)
 Q $GET(SAMIPATS(zdt,dfn,"aformdt"))
"RTN","SAMIUR2",547,0)
 ;
"RTN","SAMIUR2",548,0)
AGE(zdt,dfn,SAMIPATS) ; age
"RTN","SAMIUR2",549,0)
 ;
"RTN","SAMIUR2",550,0)
 ;;ppi;function;clean;silent;sac
"RTN","SAMIUR2",551,0)
 ;@called-by
"RTN","SAMIUR2",552,0)
 ; WSREPORT^SAMIUR
"RTN","SAMIUR2",553,0)
 ;@calls
"RTN","SAMIUR2",554,0)
 ; $$setroot^%wd
"RTN","SAMIUR2",555,0)
 ; ^%DT
"RTN","SAMIUR2",556,0)
 ; $$NOW^XLFDT
"RTN","SAMIUR2",557,0)
 ; $$FMDIFF^XLFDT
"RTN","SAMIUR2",558,0)
 ;
"RTN","SAMIUR2",559,0)
 new root set root=$$setroot^%wd("vapals-patients")
"RTN","SAMIUR2",560,0)
 new dob set dob=$get(@root@(dfn,"sbdob")) ; dob in VAPALS format
"RTN","SAMIUR2",561,0)
 ;
"RTN","SAMIUR2",562,0)
 new Y
"RTN","SAMIUR2",563,0)
 new X set X=dob
"RTN","SAMIUR2",564,0)
 do ^%DT
"RTN","SAMIUR2",565,0)
 ;
"RTN","SAMIUR2",566,0)
 new age set age=$piece($$FMDIFF^XLFDT($$NOW^XLFDT,Y)/365,".")
"RTN","SAMIUR2",567,0)
 ;
"RTN","SAMIUR2",568,0)
 quit age ; end of ppi $$AGE^SAMIUR2
"RTN","SAMIUR2",569,0)
 ;
"RTN","SAMIUR2",570,0)
 ;
"RTN","SAMIUR2",571,0)
 ;
"RTN","SAMIUR2",572,0)
BLINEDT(zdt,dfn,SAMIPATS) ; baseline date
"RTN","SAMIUR2",573,0)
 ;
"RTN","SAMIUR2",574,0)
 ;;ppi;function;clean;silent;sac
"RTN","SAMIUR2",575,0)
 ;@called-by
"RTN","SAMIUR2",576,0)
 ; WSREPORT^SAMIUR
"RTN","SAMIUR2",577,0)
 ;@calls
"RTN","SAMIUR2",578,0)
 ; $$TDDT
"RTN","SAMIUR2",579,0)
 ;
"RTN","SAMIUR2",580,0)
 new bldt set bldt=$get(SAMIPATS(zdt,dfn,"edate"))
"RTN","SAMIUR2",581,0)
 ;
"RTN","SAMIUR2",582,0)
 quit $$TDDT(bldt) ; end of ppi $$BLINEDT^SAMIUR2
"RTN","SAMIUR2",583,0)
 ;
"RTN","SAMIUR2",584,0)
 ;
"RTN","SAMIUR2",585,0)
 ;
"RTN","SAMIUR2",586,0)
CONTACT(zdt,dfn,SAMIPATS) ; patient street address
"RTN","SAMIUR2",587,0)
 ;
"RTN","SAMIUR2",588,0)
 ;;ppi;function;clean;silent;sac
"RTN","SAMIUR2",589,0)
 ;@called-by
"RTN","SAMIUR2",590,0)
 ; WSREPORT^SAMIUR
"RTN","SAMIUR2",591,0)
 ;@calls
"RTN","SAMIUR2",592,0)
 ; $$setroot^%wd
"RTN","SAMIUR2",593,0)
 ;
"RTN","SAMIUR2",594,0)
 new contact set contact=""
"RTN","SAMIUR2",595,0)
 new root set root=$$setroot^%wd("vapals-patients")
"RTN","SAMIUR2",596,0)
 new sid set sid=$get(@root@(dfn,"samistudyid"))
"RTN","SAMIUR2",597,0)
 new siform set siform=$get(SAMIPATS(zdt,dfn,"siform"))
"RTN","SAMIUR2",598,0)
 q:siform=""
"RTN","SAMIUR2",599,0)
 new vals set vals=$name(@root@("graph",sid,siform))
"RTN","SAMIUR2",600,0)
 set contact=$get(@vals@("sinamef"))_" "_$get(@vals@("sinamel"))
"RTN","SAMIUR2",601,0)
 set contact=contact_"<br>"_$get(@vals@("sipsa"))
"RTN","SAMIUR2",602,0)
 if $get(@vals@("sipan"))'="" do
"RTN","SAMIUR2",603,0)
 . set contact=contact_" Apt "_$get(@vals@("sipan"))
"RTN","SAMIUR2",604,0)
 . quit
"RTN","SAMIUR2",605,0)
 if $get(@vals@("sipcn"))'="" do
"RTN","SAMIUR2",606,0)
 . set contact=contact_"<br>County "_@vals@("sipcn")
"RTN","SAMIUR2",607,0)
 . quit
"RTN","SAMIUR2",608,0)
 if $get(@vals@("sipc"))'="" do
"RTN","SAMIUR2",609,0)
 . set contact=contact_" <br>"_@vals@("sipc")_", "
"RTN","SAMIUR2",610,0)
 . quit
"RTN","SAMIUR2",611,0)
 set contact=contact_" "_$get(@vals@("sips"))_" "_$get(@vals@("sipz"))_"     "
"RTN","SAMIUR2",612,0)
 ;
"RTN","SAMIUR2",613,0)
 new phone set phone=$get(@vals@("sippn"))
"RTN","SAMIUR2",614,0)
 if phone'="" set contact=contact_" <br>Phone: "_phone
"RTN","SAMIUR2",615,0)
 ;
"RTN","SAMIUR2",616,0)
 quit contact ; end of ppi $$CONTACT^SAMIUR2
"RTN","SAMIUR2",617,0)
 ;
"RTN","SAMIUR2",618,0)
 ;
"RTN","SAMIUR2",619,0)
 ;
"RTN","SAMIUR2",620,0)
CTPROT(zdt,dfn,SAMIPATS) ; ct protocol
"RTN","SAMIUR2",621,0)
 ;
"RTN","SAMIUR2",622,0)
 ;;ppi;function;clean;silent;sac
"RTN","SAMIUR2",623,0)
 ;@called-by
"RTN","SAMIUR2",624,0)
 ; WSREPORT^SAMIUR
"RTN","SAMIUR2",625,0)
 ;@calls
"RTN","SAMIUR2",626,0)
 ; $$setroot^%wd
"RTN","SAMIUR2",627,0)
 ;
"RTN","SAMIUR2",628,0)
 new root set root=$$setroot^%wd("vapals-patients")
"RTN","SAMIUR2",629,0)
 new ceform set ceform=$get(SAMIPATS(zdt,dfn,"ceform"))
"RTN","SAMIUR2",630,0)
 quit:ceform="" ""
"RTN","SAMIUR2",631,0)
 ;
"RTN","SAMIUR2",632,0)
 new sid set sid=$get(@root@(dfn,"samistudyid"))
"RTN","SAMIUR2",633,0)
 new vals set vals=$name(@root@("graph",sid,ceform))
"RTN","SAMIUR2",634,0)
 new cectp set cectp=$get(@vals@("cectp"))
"RTN","SAMIUR2",635,0)
 new ctyp set ctyp=$select(cectp="l":"Low-Dose CT",cectp="d":"Standard CT",cectp="i":"Limited",1:"")
"RTN","SAMIUR2",636,0)
 ;
"RTN","SAMIUR2",637,0)
 quit ctyp ; end of ppi $$CTPROT^SAMIUR2
"RTN","SAMIUR2",638,0)
 ;
"RTN","SAMIUR2",639,0)
 ;
"RTN","SAMIUR2",640,0)
 ;
"RTN","SAMIUR2",641,0)
DOB(ien,dfn,SAMIPATS) ; date of birth
"RTN","SAMIUR2",642,0)
 ;
"RTN","SAMIUR2",643,0)
 ;;ppi;function;clean;silent;sac
"RTN","SAMIUR2",644,0)
 ;@called-by
"RTN","SAMIUR2",645,0)
 ; WSREPORT^SAMIUR
"RTN","SAMIUR2",646,0)
 ;@calls
"RTN","SAMIUR2",647,0)
 ; $$TDDT
"RTN","SAMIUR2",648,0)
 ;
"RTN","SAMIUR2",649,0)
 new dob set dob=$get(SAMIPATS(ien,dfn,"dob"))
"RTN","SAMIUR2",650,0)
 if dob="" set dob=$get(SAMIPATS(ien,dfn,"sbdob"))
"RTN","SAMIUR2",651,0)
 ;
"RTN","SAMIUR2",652,0)
 quit $$TDDT(dob) ; end of ppi $$DOB^SAMIUR2
"RTN","SAMIUR2",653,0)
 ;
"RTN","SAMIUR2",654,0)
 ;
"RTN","SAMIUR2",655,0)
 ;
"RTN","SAMIUR2",656,0)
FUDATE(zdt,dfn,SAMIPATS) ; followup date
"RTN","SAMIUR2",657,0)
 ;
"RTN","SAMIUR2",658,0)
 ;;ppi;function;clean;silent;sac
"RTN","SAMIUR2",659,0)
 ;@called-by
"RTN","SAMIUR2",660,0)
 ; WSREPORT^SAMIUR
"RTN","SAMIUR2",661,0)
 ;@calls
"RTN","SAMIUR2",662,0)
 ; $TDDT
"RTN","SAMIUR2",663,0)
 ;
"RTN","SAMIUR2",664,0)
 new fud set fud="fudate"
"RTN","SAMIUR2",665,0)
 new date set date=$get(SAMIPATS(zdt,dfn,"cefud"))
"RTN","SAMIUR2",666,0)
 ;
"RTN","SAMIUR2",667,0)
 quit $$TDDT(date) ; end of ppi $$FUDATE^SAMIUR2
"RTN","SAMIUR2",668,0)
 ;
"RTN","SAMIUR2",669,0)
 ;
"RTN","SAMIUR2",670,0)
 ;
"RTN","SAMIUR2",671,0)
GENDER(zdt,dfn,SAMIPATS) ; gender
"RTN","SAMIUR2",672,0)
 ;
"RTN","SAMIUR2",673,0)
 ;;ppi;function;clean;silent;sac
"RTN","SAMIUR2",674,0)
 ;@called-by
"RTN","SAMIUR2",675,0)
 ; WSREPORT^SAMIUR
"RTN","SAMIUR2",676,0)
 ;@calls
"RTN","SAMIUR2",677,0)
 ; $$setroot^%wd
"RTN","SAMIUR2",678,0)
 ;
"RTN","SAMIUR2",679,0)
 new root set root=$$setroot^%wd("vapals-patients")
"RTN","SAMIUR2",680,0)
 new lroot set lroot=$$setroot^%wd("patient-lookup")
"RTN","SAMIUR2",681,0)
 ;
"RTN","SAMIUR2",682,0)
 new gend set gend=$get(SAMIPATS(zdt,dfn,"gender"))
"RTN","SAMIUR2",683,0)
 if gend="" do
"RTN","SAMIUR2",684,0)
 . new pien set pien=$order(@root@("dfn",dfn,""))
"RTN","SAMIUR2",685,0)
 . if pien'="" do  ;
"RTN","SAMIUR2",686,0)
 . . set gend=$get(@root@(pien,"sex"))
"RTN","SAMIUR2",687,0)
 . . if gend="" set gend=$get(@root@(pien,"gender"))
"RTN","SAMIUR2",688,0)
 . . quit
"RTN","SAMIUR2",689,0)
 . if gend="" do  ;
"RTN","SAMIUR2",690,0)
 . . new lien set lien=$order(@lroot@("dfn",dfn,""))
"RTN","SAMIUR2",691,0)
 . . set gend=$get(@lroot@(lien,"gender"))
"RTN","SAMIUR2",692,0)
 . . quit
"RTN","SAMIUR2",693,0)
 if gend["^" set gend=$piece(gend,"^",1)
"RTN","SAMIUR2",694,0)
 ;
"RTN","SAMIUR2",695,0)
 quit gend ; end of ppi $$GENDER^SAMIUR2
"RTN","SAMIUR2",696,0)
 ;
"RTN","SAMIUR2",697,0)
 ;
"RTN","SAMIUR2",698,0)
 ;
"RTN","SAMIUR2",699,0)
IFORM(zdt,dfn,SAMIPATS) ; name(s) of incomplete forms
"RTN","SAMIUR2",700,0)
 ;
"RTN","SAMIUR2",701,0)
 ;;ppi;function;clean;silent;sac
"RTN","SAMIUR2",702,0)
 ;@called-by
"RTN","SAMIUR2",703,0)
 ; WSREPORT^SAMIUR
"RTN","SAMIUR2",704,0)
 ;@calls
"RTN","SAMIUR2",705,0)
 ; $$DFN2SID^SAMIUR2
"RTN","SAMIUR2",706,0)
 ; $$KEY2FM^SAMICASE
"RTN","SAMIUR2",707,0)
 ; $$VAPALSDT^SAMICASE
"RTN","SAMIUR2",708,0)
 ; $$MKNAV
"RTN","SAMIUR2",709,0)
 ;
"RTN","SAMIUR2",710,0)
 new iform set iform=$get(SAMIPATS(zdt,dfn,"iform"))
"RTN","SAMIUR2",711,0)
 quit:iform="" ""  ;
"RTN","SAMIUR2",712,0)
 ;
"RTN","SAMIUR2",713,0)
 new zkey1,zn,typ
"RTN","SAMIUR2",714,0)
 new return set return="<table>"
"RTN","SAMIUR2",715,0)
 for zn=2:1  quit:$piece(iform," ",zn)=""  do  ;
"RTN","SAMIUR2",716,0)
 . set return=return_"<tr><td>"
"RTN","SAMIUR2",717,0)
 . set zkey1=$piece(iform," ",zn)
"RTN","SAMIUR2",718,0)
 . ;
"RTN","SAMIUR2",719,0)
 . new fname
"RTN","SAMIUR2",720,0)
 . if zkey1["ceform" set fname="CT Evaluation" set typ="ceform"
"RTN","SAMIUR2",721,0)
 . if zkey1["sbform" set fname="Background" set typ="sbform"
"RTN","SAMIUR2",722,0)
 . if zkey1["fuform" set fname="Participant Follow-up" set typ="fuform"
"RTN","SAMIUR2",723,0)
 . if zkey1["bxform" set fname="Biopsy" set typ="bxform"
"RTN","SAMIUR2",724,0)
 . if zkey1["ptform" set fname="PET Evaluation" set typ="ptform"
"RTN","SAMIUR2",725,0)
 . if zkey1["itform" set fname="Intervention" set typ="itform"
"RTN","SAMIUR2",726,0)
 . if zkey1["siform" set fname="Intake Form" set typ="siform"
"RTN","SAMIUR2",727,0)
 . if $get(fname)="" set fname="unknown" set typ=""
"RTN","SAMIUR2",728,0)
 . ;
"RTN","SAMIUR2",729,0)
 . new sid set sid=$$DFN2SID^SAMIUR2(dfn)
"RTN","SAMIUR2",730,0)
 . new zdate set zdate=$$VAPALSDT^SAMICASE($$KEY2FM^SAMICASE(zkey1))
"RTN","SAMIUR2",731,0)
 . set return=return_$$MKNAV(sid,zkey1,fname_" - "_zdate,typ)
"RTN","SAMIUR2",732,0)
 . set return=return_"</td></tr>"
"RTN","SAMIUR2",733,0)
 . quit
"RTN","SAMIUR2",734,0)
 ;
"RTN","SAMIUR2",735,0)
 set return=return_"</table>"
"RTN","SAMIUR2",736,0)
 ;
"RTN","SAMIUR2",737,0)
 quit return ; end of ppi $$IFORM^SAMIUR2
"RTN","SAMIUR2",738,0)
 ;
"RTN","SAMIUR2",739,0)
 ;
"RTN","SAMIUR2",740,0)
 ;
"RTN","SAMIUR2",741,0)
LASTEXM(zdt,dfn,SAMIPATS) ; patient last exam
"RTN","SAMIUR2",742,0)
 ;
"RTN","SAMIUR2",743,0)
 ;;ppi;function;clean;silent;sac
"RTN","SAMIUR2",744,0)
 ;@called-by
"RTN","SAMIUR2",745,0)
 ; WSREPORT^SAMIUR
"RTN","SAMIUR2",746,0)
 ;@calls
"RTN","SAMIUR2",747,0)
 ; $$TDDT
"RTN","SAMIUR2",748,0)
 ;
"RTN","SAMIUR2",749,0)
 new lexm set lexm=$get(SAMIPATS(zdt,dfn,"cedos"))
"RTN","SAMIUR2",750,0)
 ;
"RTN","SAMIUR2",751,0)
 quit $$TDDT(lexm) ; end of ppi $$LASTEXM^SAMIUR2
"RTN","SAMIUR2",752,0)
 ;
"RTN","SAMIUR2",753,0)
 ;
"RTN","SAMIUR2",754,0)
 ;
"RTN","SAMIUR2",755,0)
INACTDT(zdt,dfn,SAMIPATS) ; inactive date
"RTN","SAMIUR2",756,0)
 ;
"RTN","SAMIUR2",757,0)
 ;;ppi;function;clean;silent;sac
"RTN","SAMIUR2",758,0)
 ;@called-by
"RTN","SAMIUR2",759,0)
 ; WSREPORT^SAMIUR
"RTN","SAMIUR2",760,0)
 ;@calls
"RTN","SAMIUR2",761,0)
 ; $$setroot^%wd
"RTN","SAMIUR2",762,0)
 ; $$TDDT
"RTN","SAMIUR2",763,0)
 ;
"RTN","SAMIUR2",764,0)
 new root set root=$$setroot^%wd("vapals-patients")
"RTN","SAMIUR2",765,0)
 new sid set sid=$get(@root@(dfn,"samistudyid"))
"RTN","SAMIUR2",766,0)
 new siform set siform=$get(SAMIPATS(zdt,dfn,"siform"))
"RTN","SAMIUR2",767,0)
 new vals set vals=$name(@root@("graph",sid,siform))
"RTN","SAMIUR2",768,0)
 ;
"RTN","SAMIUR2",769,0)
 quit $$TDDT($get(@vals@("sidod")))
"RTN","SAMIUR2",770,0)
 ;
"RTN","SAMIUR2",771,0)
 ;
"RTN","SAMIUR2",772,0)
 ;
"RTN","SAMIUR2",773,0)
INACTRE(zdt,dfn,SAMIPATS) ; inactive date
"RTN","SAMIUR2",774,0)
 ;
"RTN","SAMIUR2",775,0)
 ;;ppi;function;clean;silent;sac
"RTN","SAMIUR2",776,0)
 ;@called-by
"RTN","SAMIUR2",777,0)
 ; WSREPORT^SAMIUR
"RTN","SAMIUR2",778,0)
 ;@calls
"RTN","SAMIUR2",779,0)
 ; $$setroot^%wd
"RTN","SAMIUR2",780,0)
 ;
"RTN","SAMIUR2",781,0)
 new root set root=$$setroot^%wd("vapals-patients")
"RTN","SAMIUR2",782,0)
 new sid set sid=$get(@root@(dfn,"samistudyid"))
"RTN","SAMIUR2",783,0)
 new siform set siform=$get(SAMIPATS(zdt,dfn,"siform"))
"RTN","SAMIUR2",784,0)
 new vals set vals=$name(@root@("graph",sid,siform))
"RTN","SAMIUR2",785,0)
 ;
"RTN","SAMIUR2",786,0)
 quit $get(@vals@("sistachg"))
"RTN","SAMIUR2",787,0)
 ;
"RTN","SAMIUR2",788,0)
 ;
"RTN","SAMIUR2",789,0)
 ;
"RTN","SAMIUR2",790,0)
INACTCM(zdt,dfn,SAMIPATS) ; inactive date
"RTN","SAMIUR2",791,0)
 ;
"RTN","SAMIUR2",792,0)
 ;;ppi;function;clean;silent;sac
"RTN","SAMIUR2",793,0)
 ;@called-by
"RTN","SAMIUR2",794,0)
 ; WSREPORT^SAMIUR
"RTN","SAMIUR2",795,0)
 ;@calls
"RTN","SAMIUR2",796,0)
 ; $$setroot^%wd
"RTN","SAMIUR2",797,0)
 ;
"RTN","SAMIUR2",798,0)
 new root set root=$$setroot^%wd("vapals-patients")
"RTN","SAMIUR2",799,0)
 new sid set sid=$get(@root@(dfn,"samistudyid"))
"RTN","SAMIUR2",800,0)
 new siform set siform=$get(SAMIPATS(zdt,dfn,"siform"))
"RTN","SAMIUR2",801,0)
 new vals set vals=$name(@root@("graph",sid,siform))
"RTN","SAMIUR2",802,0)
 ;
"RTN","SAMIUR2",803,0)
 quit $get(@vals@("sistreas"))
"RTN","SAMIUR2",804,0)
 ;
"RTN","SAMIUR2",805,0)
 ;
"RTN","SAMIUR2",806,0)
 ;
"RTN","SAMIUR2",807,0)
LDE(zdt,dfn,SAMIPATS) ; last date and entry in com log
"RTN","SAMIUR2",808,0)
 ;
"RTN","SAMIUR2",809,0)
 ;;ppi;function;clean;silent;sac
"RTN","SAMIUR2",810,0)
 ;@called-by
"RTN","SAMIUR2",811,0)
 ; WSREPORT^SAMIUR
"RTN","SAMIUR2",812,0)
 ;@calls
"RTN","SAMIUR2",813,0)
 ; $$setroot^%wd
"RTN","SAMIUR2",814,0)
 ;
"RTN","SAMIUR2",815,0)
 new root set root=$$setroot^%wd("vapals-patients")
"RTN","SAMIUR2",816,0)
 new sid set sid=$get(@root@(dfn,"samistudyid"))
"RTN","SAMIUR2",817,0)
 new siform set siform=$get(SAMIPATS(zdt,dfn,"siform"))
"RTN","SAMIUR2",818,0)
 new vals set vals=$name(@root@("graph",sid,siform))
"RTN","SAMIUR2",819,0)
 ;
"RTN","SAMIUR2",820,0)
 n comien,comdt,comntry
"RTN","SAMIUR2",821,0)
 s (comdt,comntry)=""
"RTN","SAMIUR2",822,0)
 s comien=$o(@vals@("comlog"," "),-1)
"RTN","SAMIUR2",823,0)
 i comien="" d  q comdt
"RTN","SAMIUR2",824,0)
 . s comdt=$g(@vals@("sidc"))
"RTN","SAMIUR2",825,0)
 s comntry=$g(@vals@("comlog",comien))
"RTN","SAMIUR2",826,0)
 s comdt=$p($p(comntry,"[",2),"@",1)
"RTN","SAMIUR2",827,0)
 ;
"RTN","SAMIUR2",828,0)
 quit comdt_"^"_comntry
"RTN","SAMIUR2",829,0)
 ;
"RTN","SAMIUR2",830,0)
 ;
"RTN","SAMIUR2",831,0)
 ;
"RTN","SAMIUR2",832,0)
LDOC(zdt,dfn,SAMIPATS) ; last date of contact
"RTN","SAMIUR2",833,0)
 ;
"RTN","SAMIUR2",834,0)
 quit $$TDDT($piece($$LDE(zdt,dfn,.SAMIPATS),"^",1))
"RTN","SAMIUR2",835,0)
 ;
"RTN","SAMIUR2",836,0)
 ;
"RTN","SAMIUR2",837,0)
 ;
"RTN","SAMIUR2",838,0)
LENTRY(zdt,dfn,SAMIPATS) ; last contact entry
"RTN","SAMIUR2",839,0)
 ;
"RTN","SAMIUR2",840,0)
 quit $piece($$LDE(zdt,dfn,.SAMIPATS),"^",2)
"RTN","SAMIUR2",841,0)
 ;
"RTN","SAMIUR2",842,0)
 ;
"RTN","SAMIUR2",843,0)
 ;
"RTN","SAMIUR2",844,0)
MANPAT(ien,dfn,SAMIPATS) ; unmatched patient cell
"RTN","SAMIUR2",845,0)
 ;
"RTN","SAMIUR2",846,0)
 ;;ppi;function;clean;silent;sac
"RTN","SAMIUR2",847,0)
 ;@called-by
"RTN","SAMIUR2",848,0)
 ; WSREPORT^SAMIUR
"RTN","SAMIUR2",849,0)
 ;@calls
"RTN","SAMIUR2",850,0)
 ; $$setroot^%wd
"RTN","SAMIUR2",851,0)
 ;
"RTN","SAMIUR2",852,0)
 new zcell set zcell=""
"RTN","SAMIUR2",853,0)
 ; set zcell=zcell_$get(SAMIPATS(ien,dfn,"saminame"))
"RTN","SAMIUR2",854,0)
 set zcell=zcell_$get(SAMIPATS(ien,dfn,"editref"))
"RTN","SAMIUR2",855,0)
 set zcell=zcell_"<br>Date of Birth: "_$get(SAMIPATS(ien,dfn,"dob"))
"RTN","SAMIUR2",856,0)
 set zcell=zcell_" Gender: "_$get(SAMIPATS(ien,dfn,"sex"))
"RTN","SAMIUR2",857,0)
 ;
"RTN","SAMIUR2",858,0)
 new ssn set ssn=$get(SAMIPATS(ien,dfn,"ssn"))
"RTN","SAMIUR2",859,0)
 if ssn="" do  ;
"RTN","SAMIUR2",860,0)
 . new lroot set lroot=$$setroot^%wd("patient-lookup")
"RTN","SAMIUR2",861,0)
 . new tssn set tssn=$get(@lroot@(ien,"ssn"))
"RTN","SAMIUR2",862,0)
 . set ssn=$extract(tssn,1,3)_"-"_$extract(tssn,4,5)_"-"_$extract(tssn,6,9)
"RTN","SAMIUR2",863,0)
 . quit
"RTN","SAMIUR2",864,0)
 set zcell=zcell_"<br>SSN: "_ssn
"RTN","SAMIUR2",865,0)
 ;
"RTN","SAMIUR2",866,0)
 set zcell=zcell_"<br>dfn: "_dfn
"RTN","SAMIUR2",867,0)
 ;
"RTN","SAMIUR2",868,0)
 quit zcell ; end of ppi $$MANPAT^SAMIUR2
"RTN","SAMIUR2",869,0)
 ;
"RTN","SAMIUR2",870,0)
 ;
"RTN","SAMIUR2",871,0)
 ;
"RTN","SAMIUR2",872,0)
MATCH(ien,dfn,SAMIPATS) ; match button cell
"RTN","SAMIUR2",873,0)
 ;
"RTN","SAMIUR2",874,0)
 ;;ppi;function;clean;silent;sac
"RTN","SAMIUR2",875,0)
 ;@called-by
"RTN","SAMIUR2",876,0)
 ; WSREPORT^SAMIUR
"RTN","SAMIUR2",877,0)
 ;@calls none
"RTN","SAMIUR2",878,0)
 ;
"RTN","SAMIUR2",879,0)
 new matien set matien=$get(SAMIPATS(ien,dfn,"MATCHLOG"))
"RTN","SAMIUR2",880,0)
 quit:matien="" ""
"RTN","SAMIUR2",881,0)
 ;
"RTN","SAMIUR2",882,0)
 new nuhref set nuhref="<form method=POST action=""/vapals"">"
"RTN","SAMIUR2",883,0)
 set nuhref=nuhref_"<input type=hidden name=""samiroute"" value=""merge"">"
"RTN","SAMIUR2",884,0)
 set nuhref=nuhref_"<input type=hidden name=""toien"" value="_ien_">"
"RTN","SAMIUR2",885,0)
 set nuhref=nuhref_"<input value=""Merge"" class=""btn btn-link"" role=""link"" type=""submit""></form>"
"RTN","SAMIUR2",886,0)
 ;
"RTN","SAMIUR2",887,0)
 quit nuhref ; end of ppi $$MATCH^SAMIUR2
"RTN","SAMIUR2",888,0)
 ;
"RTN","SAMIUR2",889,0)
 ;
"RTN","SAMIUR2",890,0)
 ;
"RTN","SAMIUR2",891,0)
NAME(zdt,dfn,SAMIPATS) ; name w/hyperlink
"RTN","SAMIUR2",892,0)
 ;
"RTN","SAMIUR2",893,0)
 ;;ppi;function;clean;silent;sac
"RTN","SAMIUR2",894,0)
 ;@called-by
"RTN","SAMIUR2",895,0)
 ; WSREPORT^SAMIUR
"RTN","SAMIUR2",896,0)
 ;@calls none
"RTN","SAMIUR2",897,0)
 ;
"RTN","SAMIUR2",898,0)
 new nam set nam="Name"
"RTN","SAMIUR2",899,0)
 ;
"RTN","SAMIUR2",900,0)
 quit $get(SAMIPATS(zdt,dfn,"nuhref")) ; end of ppi $$NAME^SAMIUR2
"RTN","SAMIUR2",901,0)
 ;
"RTN","SAMIUR2",902,0)
 ;
"RTN","SAMIUR2",903,0)
 ;
"RTN","SAMIUR2",904,0)
PACKYRS(zdt,dfn,SAMIPATS) ; smoking status
"RTN","SAMIUR2",905,0)
 ;
"RTN","SAMIUR2",906,0)
 ;;ppi;function;clean;silent;sac
"RTN","SAMIUR2",907,0)
 ;@called-by
"RTN","SAMIUR2",908,0)
 ; WSREPORT^SAMIUR
"RTN","SAMIUR2",909,0)
 ;@calls
"RTN","SAMIUR2",910,0)
 ; $$setroot^%wd
"RTN","SAMIUR2",911,0)
 ;
"RTN","SAMIUR2",912,0)
 new root set root=$$setroot^%wd("vapals-patients")
"RTN","SAMIUR2",913,0)
 new sid set sid=$get(@root@(dfn,"samistudyid"))
"RTN","SAMIUR2",914,0)
 new siform set siform=$get(SAMIPATS(zdt,dfn,"siform"))
"RTN","SAMIUR2",915,0)
 new vals set vals=$name(@root@("graph",sid,siform))
"RTN","SAMIUR2",916,0)
 new pkyrs set pkyrs=$get(@vals@("sippy"))
"RTN","SAMIUR2",917,0)
 ;
"RTN","SAMIUR2",918,0)
 quit pkyrs ; end of ppi $$PACKYRS^SAMIUR2
"RTN","SAMIUR2",919,0)
 ;
"RTN","SAMIUR2",920,0)
 ;
"RTN","SAMIUR2",921,0)
 ;
"RTN","SAMIUR2",922,0)
POSSIBLE(ien,dfn,SAMIPATS) ; possible match cell
"RTN","SAMIUR2",923,0)
 ;
"RTN","SAMIUR2",924,0)
 ;;ppi;function;clean;silent;sac
"RTN","SAMIUR2",925,0)
 ;@called-by
"RTN","SAMIUR2",926,0)
 ; WSREPORT^SAMIUR
"RTN","SAMIUR2",927,0)
 ;@calls
"RTN","SAMIUR2",928,0)
 ; $$setroot^%wd
"RTN","SAMIUR2",929,0)
 ;
"RTN","SAMIUR2",930,0)
 new zcell set zcell=""
"RTN","SAMIUR2",931,0)
 new matien set matien=$get(SAMIPATS(ien,dfn,"MATCHLOG"))
"RTN","SAMIUR2",932,0)
 quit:matien="" zcell
"RTN","SAMIUR2",933,0)
 ;
"RTN","SAMIUR2",934,0)
 new lroot set lroot=$$setroot^%wd("patient-lookup")
"RTN","SAMIUR2",935,0)
 quit:'$data(@lroot@(matien)) zcell
"RTN","SAMIUR2",936,0)
 ;
"RTN","SAMIUR2",937,0)
 set zcell=zcell_$get(@lroot@(matien,"saminame"))
"RTN","SAMIUR2",938,0)
 set zcell=zcell_"<br>Date of Birth: "_$get(@lroot@(matien,"sbdob"))
"RTN","SAMIUR2",939,0)
 set zcell=zcell_" Gender: "_$get(@lroot@(matien,"sex"))
"RTN","SAMIUR2",940,0)
 ;
"RTN","SAMIUR2",941,0)
 new tssn set tssn=$get(@lroot@(matien,"ssn"))
"RTN","SAMIUR2",942,0)
 new ssn set ssn=tssn
"RTN","SAMIUR2",943,0)
 if tssn'["-" set ssn=$extract(tssn,1,3)_"-"_$extract(tssn,4,5)_"-"_$extract(tssn,6,9)
"RTN","SAMIUR2",944,0)
 set zcell=zcell_"<br>SSN: "_ssn
"RTN","SAMIUR2",945,0)
 ;
"RTN","SAMIUR2",946,0)
 set zcell=zcell_"<br>dfn: "_$get(@lroot@(matien,"dfn"))
"RTN","SAMIUR2",947,0)
 ;
"RTN","SAMIUR2",948,0)
 quit zcell ; end of ppi $$POSSIBLE^SAMIUR2
"RTN","SAMIUR2",949,0)
 ;
"RTN","SAMIUR2",950,0)
 ;
"RTN","SAMIUR2",951,0)
 ;
"RTN","SAMIUR2",952,0)
RECOM(zdt,dfn,SAMIPATS) ; recommendation
"RTN","SAMIUR2",953,0)
 ;
"RTN","SAMIUR2",954,0)
 ;;ppi;function;clean;silent;sac
"RTN","SAMIUR2",955,0)
 ;@called-by
"RTN","SAMIUR2",956,0)
 ; WSREPORT^SAMIUR
"RTN","SAMIUR2",957,0)
 ;@calls
"RTN","SAMIUR2",958,0)
 ; $$setroot^%wd
"RTN","SAMIUR2",959,0)
 ;
"RTN","SAMIUR2",960,0)
 new root set root=$$setroot^%wd("vapals-patients")
"RTN","SAMIUR2",961,0)
 new ceform set ceform=$get(SAMIPATS(zdt,dfn,"ceform"))
"RTN","SAMIUR2",962,0)
 quit:ceform="" ""
"RTN","SAMIUR2",963,0)
 ;
"RTN","SAMIUR2",964,0)
 new sid set sid=$get(@root@(dfn,"samistudyid"))
"RTN","SAMIUR2",965,0)
 new vals set vals=$name(@root@("graph",sid,ceform))
"RTN","SAMIUR2",966,0)
 new cefuw set cefuw=$get(@vals@("cefuw"))
"RTN","SAMIUR2",967,0)
 ;
"RTN","SAMIUR2",968,0)
 new recom set recom=""
"RTN","SAMIUR2",969,0)
 set recom=$select(cefuw="1y":"Annual Repeat",cefuw="nw":"Now",cefuw="1m":"1 month",cefuw="3m":"3 months",cefuw="6m":"6 months",cefuw="os":"Other",1:"")
"RTN","SAMIUR2",970,0)
 if $get(@vals@("cefuaf"))="y" set recom=recom_", Antibiotics"
"RTN","SAMIUR2",971,0)
 if $get(@vals@("cefucc"))="y" set recom=recom_", Contrast CT"
"RTN","SAMIUR2",972,0)
 if $get(@vals@("cefupe"))="y" set recom=recom_", PET"
"RTN","SAMIUR2",973,0)
 if $get(@vals@("cefufn"))="y" set recom=recom_", Percutaneous biopsy"
"RTN","SAMIUR2",974,0)
 if $get(@vals@("cefubr"))="y" set recom=recom_", Bronchoscopy"
"RTN","SAMIUR2",975,0)
 if $get(@vals@("cefupc"))="y" set recom=recom_", Pulmonary consultation"
"RTN","SAMIUR2",976,0)
 if $get(@vals@("cefutb"))="y" set recom=recom_", Refer to tumor board"
"RTN","SAMIUR2",977,0)
 if $get(@vals@("cefunf"))="y" set recom=recom_", No other further follow-up"
"RTN","SAMIUR2",978,0)
 if $extract(recom,1,2)=", " set recom=$extract(recom,3,$length(recom))
"RTN","SAMIUR2",979,0)
 ;
"RTN","SAMIUR2",980,0)
 quit recom ; end of ppi $$RECOM^SAMIUR2
"RTN","SAMIUR2",981,0)
 ;
"RTN","SAMIUR2",982,0)
 ;
"RTN","SAMIUR2",983,0)
 ;
"RTN","SAMIUR2",984,0)
RURAL(zdt,dfn,SAMIPATS) ; patient's rural/urban status
"RTN","SAMIUR2",985,0)
 ;
"RTN","SAMIUR2",986,0)
 ;;ppi;function;clean;silent;sac
"RTN","SAMIUR2",987,0)
 ;@called-by
"RTN","SAMIUR2",988,0)
 ; WSREPORT^SAMIUR
"RTN","SAMIUR2",989,0)
 ;@calls
"RTN","SAMIUR2",990,0)
 ; $$setroot^%wd
"RTN","SAMIUR2",991,0)
 ;
"RTN","SAMIUR2",992,0)
 new root set root=$$setroot^%wd("vapals-patients")
"RTN","SAMIUR2",993,0)
 new sid set sid=$get(@root@(dfn,"samistudyid"))
"RTN","SAMIUR2",994,0)
 new siform set siform=$get(SAMIPATS(zdt,dfn,"siform"))
"RTN","SAMIUR2",995,0)
 new vals set vals=$name(@root@("graph",sid,siform))
"RTN","SAMIUR2",996,0)
 new sirs set sirs=$get(@vals@("sirs"))
"RTN","SAMIUR2",997,0)
 set sirs=$select(sirs="r":"rural",sirs="u":"urban",sirs="n":"unknown",1:"unknown")
"RTN","SAMIUR2",998,0)
 ;
"RTN","SAMIUR2",999,0)
 quit sirs ; end of ppi $$RURAL^SAMIUR2
"RTN","SAMIUR2",1000,0)
 ;
"RTN","SAMIUR2",1001,0)
 ;
"RTN","SAMIUR2",1002,0)
 ;
"RTN","SAMIUR2",1003,0)
SID(zdt,dfn,SAMIPATS) ; study ID
"RTN","SAMIUR2",1004,0)
 ;
"RTN","SAMIUR2",1005,0)
 ;;ppi;function;clean;silent;sac
"RTN","SAMIUR2",1006,0)
 ;@called-by
"RTN","SAMIUR2",1007,0)
 ; WSREPORT^SAMIUR
"RTN","SAMIUR2",1008,0)
 ;@calls
"RTN","SAMIUR2",1009,0)
 ; $$DFN2SID
"RTN","SAMIUR2",1010,0)
 ;
"RTN","SAMIUR2",1011,0)
 quit $$DFN2SID(dfn) ; end of ppi $$SID^SAMIUR2
"RTN","SAMIUR2",1012,0)
 ;
"RTN","SAMIUR2",1013,0)
 ;
"RTN","SAMIUR2",1014,0)
 ;
"RTN","SAMIUR2",1015,0)
SMHIS(zdt,dfn,SAMIPATS) ; smoking history cell
"RTN","SAMIUR2",1016,0)
 ;
"RTN","SAMIUR2",1017,0)
 ;;ppi;function;clean;silent;sac
"RTN","SAMIUR2",1018,0)
 ;@called-by
"RTN","SAMIUR2",1019,0)
 ; WSREPORT^SAMIUR
"RTN","SAMIUR2",1020,0)
 ;@calls
"RTN","SAMIUR2",1021,0)
 ; $$DFN2SID
"RTN","SAMIUR2",1022,0)
 ; $$SHDET
"RTN","SAMIUR2",1023,0)
 ;
"RTN","SAMIUR2",1024,0)
 new zrtn set zrtn=""
"RTN","SAMIUR2",1025,0)
 set zrtn=zrtn_"<div class=""row""><div class=""col-md-12""><table class=""table"" id=""pack-years-history"">"
"RTN","SAMIUR2",1026,0)
 set zrtn=zrtn_"<thead><tr><th>Form </th><th> Reported Date </th>"
"RTN","SAMIUR2",1027,0)
 set zrtn=zrtn_"<th>Pack Years</th><th>Cumulative</th></tr></thead><tbody>"
"RTN","SAMIUR2",1028,0)
 set zrtn=zrtn_$$SHDET($$DFN2SID(dfn))
"RTN","SAMIUR2",1029,0)
 set zrtn=zrtn_"</tbody></table></div></div>"
"RTN","SAMIUR2",1030,0)
 ;
"RTN","SAMIUR2",1031,0)
 quit zrtn ; end of ppi $$SMHIS^SAMIUR2
"RTN","SAMIUR2",1032,0)
 ;
"RTN","SAMIUR2",1033,0)
 ;
"RTN","SAMIUR2",1034,0)
 ;
"RTN","SAMIUR2",1035,0)
SMKSTAT(zdt,dfn,SAMIPATS) ; smoking status
"RTN","SAMIUR2",1036,0)
 ;
"RTN","SAMIUR2",1037,0)
 ;;ppi;function;clean;silent;sac
"RTN","SAMIUR2",1038,0)
 ;@called-by
"RTN","SAMIUR2",1039,0)
 ; WSREPORT^SAMIUR
"RTN","SAMIUR2",1040,0)
 ;@calls
"RTN","SAMIUR2",1041,0)
 ; $$setroot^%wd
"RTN","SAMIUR2",1042,0)
 ;
"RTN","SAMIUR2",1043,0)
 new root set root=$$setroot^%wd("vapals-patients")
"RTN","SAMIUR2",1044,0)
 new sid set sid=$get(@root@(dfn,"samistudyid"))
"RTN","SAMIUR2",1045,0)
 new siform set siform=$get(SAMIPATS(zdt,dfn,"siform"))
"RTN","SAMIUR2",1046,0)
 new vals set vals=$name(@root@("graph",sid,siform))
"RTN","SAMIUR2",1047,0)
 ;
"RTN","SAMIUR2",1048,0)
 new smk set smk="unknown"
"RTN","SAMIUR2",1049,0)
 if $get(@vals@("siesm"))="n" set smk="Never smoked"
"RTN","SAMIUR2",1050,0)
 if $get(@vals@("siesm"))="p" set smk="Past smoker"
"RTN","SAMIUR2",1051,0)
 if $get(@vals@("siesm"))="c" set smk="Current smoker"
"RTN","SAMIUR2",1052,0)
 ; if $get(@vals@("siesq"))=1 set smk="Cu"
"RTN","SAMIUR2",1053,0)
 ;
"RTN","SAMIUR2",1054,0)
 quit smk ; end of ppi $$SMKSTAT^SAMIUR2
"RTN","SAMIUR2",1055,0)
 ;
"RTN","SAMIUR2",1056,0)
 ;
"RTN","SAMIUR2",1057,0)
 ;
"RTN","SAMIUR2",1058,0)
SSN(zdt,dfn,SAMIPATS) ; social security number
"RTN","SAMIUR2",1059,0)
 ;
"RTN","SAMIUR2",1060,0)
 ;;ppi;function;clean;silent;sac
"RTN","SAMIUR2",1061,0)
 ;@called-by
"RTN","SAMIUR2",1062,0)
 ; WSREPORT^SAMIUR
"RTN","SAMIUR2",1063,0)
 ;@calls none
"RTN","SAMIUR2",1064,0)
 ;
"RTN","SAMIUR2",1065,0)
 new tssn set tssn=$get(SAMIPATS(zdt,dfn,"ssn"))
"RTN","SAMIUR2",1066,0)
 new ssn set ssn=tssn
"RTN","SAMIUR2",1067,0)
 if ssn'["-" do
"RTN","SAMIUR2",1068,0)
 . set ssn=$extract(tssn,1,3)_"-"_$extract(tssn,4,5)_"-"_$extract(tssn,6,9)
"RTN","SAMIUR2",1069,0)
 . quit
"RTN","SAMIUR2",1070,0)
 ;
"RTN","SAMIUR2",1071,0)
 quit ssn ; end of ppi $$SSN^SAMIUR2
"RTN","SAMIUR2",1072,0)
 ;
"RTN","SAMIUR2",1073,0)
 ;
"RTN","SAMIUR2",1074,0)
 ;
"RTN","SAMIUR2",1075,0)
SSNLABEL(SITE) ; extrinsic returns label for SSN (ie PID)
"RTN","SAMIUR2",1076,0)
 new RTN
"RTN","SAMIUR2",1077,0)
 set RTN=$$GET1PARM^SAMIPARM("socialSecurityNumber",SITE)
"RTN","SAMIUR2",1078,0)
 if RTN="" set RTN="SSN"
"RTN","SAMIUR2",1079,0)
 quit RTN
"RTN","SAMIUR2",1080,0)
 ;
"RTN","SAMIUR2",1081,0)
 ;
"RTN","SAMIUR2",1082,0)
 ;
"RTN","SAMIUR2",1083,0)
STUDYDT(zdt,dfn,SAMIPATS) ; latest study date
"RTN","SAMIUR2",1084,0)
 ;
"RTN","SAMIUR2",1085,0)
 ;;ppi;function;clean;silent;sac
"RTN","SAMIUR2",1086,0)
 ;@called-by
"RTN","SAMIUR2",1087,0)
 ; WSREPORT^SAMIUR
"RTN","SAMIUR2",1088,0)
 ;@calls
"RTN","SAMIUR2",1089,0)
 ; $$TDDT
"RTN","SAMIUR2",1090,0)
 ;
"RTN","SAMIUR2",1091,0)
 new stdt set stdt=$get(SAMIPATS(zdt,dfn,"cedos"))
"RTN","SAMIUR2",1092,0)
 ;
"RTN","SAMIUR2",1093,0)
 quit $$TDDT(stdt) ; end of ppi $$STUDYDT^SAMIUR2
"RTN","SAMIUR2",1094,0)
 ;
"RTN","SAMIUR2",1095,0)
 ;
"RTN","SAMIUR2",1096,0)
 ;
"RTN","SAMIUR2",1097,0)
STUDYTYP(zdt,dfn,SAMIPATS) ; latest study type
"RTN","SAMIUR2",1098,0)
 ;
"RTN","SAMIUR2",1099,0)
 ;;ppi;function;clean;silent;sac
"RTN","SAMIUR2",1100,0)
 ;@called-by
"RTN","SAMIUR2",1101,0)
 ; WSREPORT^SAMIUR
"RTN","SAMIUR2",1102,0)
 ;@calls
"RTN","SAMIUR2",1103,0)
 ; $$setroot^%wd
"RTN","SAMIUR2",1104,0)
 ;
"RTN","SAMIUR2",1105,0)
 new root set root=$$setroot^%wd("vapals-patients")
"RTN","SAMIUR2",1106,0)
 new ceform set ceform=$get(SAMIPATS(zdt,dfn,"ceform"))
"RTN","SAMIUR2",1107,0)
 quit:ceform="" ""
"RTN","SAMIUR2",1108,0)
 ;
"RTN","SAMIUR2",1109,0)
 new sid set sid=$get(@root@(dfn,"samistudyid"))
"RTN","SAMIUR2",1110,0)
 new vals set vals=$name(@root@("graph",sid,ceform))
"RTN","SAMIUR2",1111,0)
 new stypx set stypx=$get(@vals@("cetex"))
"RTN","SAMIUR2",1112,0)
 new styp set styp=$select(stypx="a":"Annual",stypx="b":"Baseline",stypx="d":"Followup",1:"")
"RTN","SAMIUR2",1113,0)
 ;
"RTN","SAMIUR2",1114,0)
 quit styp ; end of ppi $$STUDYTYP^SAMIUR2
"RTN","SAMIUR2",1115,0)
 ;
"RTN","SAMIUR2",1116,0)
 ;
"RTN","SAMIUR2",1117,0)
 ;
"RTN","SAMIUR2",1118,0)
VALS(zdt,dfn,SAMIPATS) ; form-values cell
"RTN","SAMIUR2",1119,0)
 ;
"RTN","SAMIUR2",1120,0)
 ;;ppi;function;clean;silent;sac
"RTN","SAMIUR2",1121,0)
 ;@called-by
"RTN","SAMIUR2",1122,0)
 ; WSREPORT^SAMIUR
"RTN","SAMIUR2",1123,0)
 ;@calls
"RTN","SAMIUR2",1124,0)
 ; $$DFN2SID
"RTN","SAMIUR2",1125,0)
 ;
"RTN","SAMIUR2",1126,0)
 new vrtn set vrtn=""
"RTN","SAMIUR2",1127,0)
 new vsid set vsid=$$DFN2SID(dfn)
"RTN","SAMIUR2",1128,0)
 new vgr set vgr="/vals?sid="_vsid_"&form="
"RTN","SAMIUR2",1129,0)
 quit:'$data(SAMIPATS)
"RTN","SAMIUR2",1130,0)
 ;
"RTN","SAMIUR2",1131,0)
 new vzi set vzi=""
"RTN","SAMIUR2",1132,0)
 for  do  quit:vzi="sort"  quit:vzi=""
"RTN","SAMIUR2",1133,0)
 . set vzi=$order(SAMIPATS(zdt,dfn,"items",vzi))
"RTN","SAMIUR2",1134,0)
 . quit:vzi="sort"
"RTN","SAMIUR2",1135,0)
 . quit:vzi=""
"RTN","SAMIUR2",1136,0)
 . set vrtn=vrtn_"<a href="""_vgr_vzi_""">"_vzi_"</a><br>"
"RTN","SAMIUR2",1137,0)
 . quit
"RTN","SAMIUR2",1138,0)
 ;
"RTN","SAMIUR2",1139,0)
 quit vrtn ; end of $$VALS^SAMIUR2
"RTN","SAMIUR2",1140,0)
 ;
"RTN","SAMIUR2",1141,0)
 ;
"RTN","SAMIUR2",1142,0)
 ;
"RTN","SAMIUR2",1143,0)
WHEN(zdt,dfn,SAMIPATS) ; followup text
"RTN","SAMIUR2",1144,0)
 ;
"RTN","SAMIUR2",1145,0)
 ;;ppi;function;clean;silent;sac
"RTN","SAMIUR2",1146,0)
 ;@called-by
"RTN","SAMIUR2",1147,0)
 ; WSREPORT^SAMIUR
"RTN","SAMIUR2",1148,0)
 ;@calls
"RTN","SAMIUR2",1149,0)
 ; $$setroot^%wd
"RTN","SAMIUR2",1150,0)
 ;
"RTN","SAMIUR2",1151,0)
 new root set root=$$setroot^%wd("vapals-patients")
"RTN","SAMIUR2",1152,0)
 new ceform set ceform=$get(SAMIPATS(zdt,dfn,"ceform"))
"RTN","SAMIUR2",1153,0)
 quit:ceform="" ""
"RTN","SAMIUR2",1154,0)
 ;
"RTN","SAMIUR2",1155,0)
 new sid set sid=$get(@root@(dfn,"samistudyid"))
"RTN","SAMIUR2",1156,0)
 new vals set vals=$name(@root@("graph",sid,ceform))
"RTN","SAMIUR2",1157,0)
 new whnx set whnx=$get(@vals@("cefuw"))
"RTN","SAMIUR2",1158,0)
 quit:whnx="" ""
"RTN","SAMIUR2",1159,0)
 ;
"RTN","SAMIUR2",1160,0)
 new DICT
"RTN","SAMIUR2",1161,0)
 set DICT("cefuw","1m")="in one month"
"RTN","SAMIUR2",1162,0)
 set DICT("cefuw","1y")="in one year"
"RTN","SAMIUR2",1163,0)
 set DICT("cefuw","3m")="in three months"
"RTN","SAMIUR2",1164,0)
 set DICT("cefuw","6m")="in six months"
"RTN","SAMIUR2",1165,0)
 set DICT("cefuw","os")="other as specified"
"RTN","SAMIUR2",1166,0)
 set whn=$get(DICT("cefuw",whnx))
"RTN","SAMIUR2",1167,0)
 ;
"RTN","SAMIUR2",1168,0)
 quit whn ; end of ppi $$WHEN^SAMIUR2
"RTN","SAMIUR2",1169,0)
 ;
"RTN","SAMIUR2",1170,0)
 ;
"RTN","SAMIUR2",1171,0)
 ;
"RTN","SAMIUR2",1172,0)
WORKPAT(ien,dfn,SAMIPATS) ; worklist patient name cell
"RTN","SAMIUR2",1173,0)
 ;
"RTN","SAMIUR2",1174,0)
 ;;ppi;function;clean;silent;sac
"RTN","SAMIUR2",1175,0)
 ;@called-by
"RTN","SAMIUR2",1176,0)
 ; WSREPORT^SAMIUR
"RTN","SAMIUR2",1177,0)
 ;@calls none
"RTN","SAMIUR2",1178,0)
 ;
"RTN","SAMIUR2",1179,0)
 new zcell set zcell=""
"RTN","SAMIUR2",1180,0)
 set zcell=zcell_$get(SAMIPATS(ien,dfn,"workref"))
"RTN","SAMIUR2",1181,0)
 ;
"RTN","SAMIUR2",1182,0)
 quit zcell ; end of ppi $$WORKPAT^SAMIUR2
"RTN","SAMIUR2",1183,0)
 ;
"RTN","SAMIUR2",1184,0)
 ;
"RTN","SAMIUR2",1185,0)
 ;
"RTN","SAMIUR2",1186,0)
 ;@section 5 unused subroutines
"RTN","SAMIUR2",1187,0)
 ;
"RTN","SAMIUR2",1188,0)
 ;
"RTN","SAMIUR2",1189,0)
 ;
"RTN","SAMIUR2",1190,0)
EPAT(ien,dfn,SAMIPATS) ; patient name w/nav to enrollment
"RTN","SAMIUR2",1191,0)
 ;
"RTN","SAMIUR2",1192,0)
 ;;private;procedure;clean;silent;sac
"RTN","SAMIUR2",1193,0)
 ;@called-by none
"RTN","SAMIUR2",1194,0)
 ;@calls none
"RTN","SAMIUR2",1195,0)
 ;
"RTN","SAMIUR2",1196,0)
 quit  ; end of $$EPAT
"RTN","SAMIUR2",1197,0)
 ;
"RTN","SAMIUR2",1198,0)
 ;
"RTN","SAMIUR2",1199,0)
 ;
"RTN","SAMIUR2",1200,0)
ETHNCTY(zdt,dfn,SAMIPATS) ; ethnicity
"RTN","SAMIUR2",1201,0)
 ;
"RTN","SAMIUR2",1202,0)
 ;;private;function;clean;silent;sac
"RTN","SAMIUR2",1203,0)
 ;@called-by none
"RTN","SAMIUR2",1204,0)
 ;@calls none
"RTN","SAMIUR2",1205,0)
 ;
"RTN","SAMIUR2",1206,0)
 quit "ethnicity" ; end of $$ETHNCTY
"RTN","SAMIUR2",1207,0)
 ;
"RTN","SAMIUR2",1208,0)
 ;
"RTN","SAMIUR2",1209,0)
 ;
"RTN","SAMIUR2",1210,0)
RACE(zdt,dfn,SAMIPATS) ; race
"RTN","SAMIUR2",1211,0)
 ;
"RTN","SAMIUR2",1212,0)
 ;;private;function;clean;silent;sac
"RTN","SAMIUR2",1213,0)
 ;@called-by none [call commented out in RPTTBL]
"RTN","SAMIUR2",1214,0)
 ;@calls
"RTN","SAMIUR2",1215,0)
 ; $$setroot^%wd
"RTN","SAMIUR2",1216,0)
 ;
"RTN","SAMIUR2",1217,0)
 new root set root=$$setroot^%wd("vapals-patients")
"RTN","SAMIUR2",1218,0)
 new race set race=$get(@root@(dfn,"race"))
"RTN","SAMIUR2",1219,0)
 ;
"RTN","SAMIUR2",1220,0)
 quit race ; end of $$RACE
"RTN","SAMIUR2",1221,0)
 ;
"RTN","SAMIUR2",1222,0)
 ;
"RTN","SAMIUR2",1223,0)
 ;
"RTN","SAMIUR2",1224,0)
STATUS(zdt,dfn,SAMIPATS) ; patient status
"RTN","SAMIUR2",1225,0)
 ;
"RTN","SAMIUR2",1226,0)
 ;;private;function;clean;silent;sac
"RTN","SAMIUR2",1227,0)
 ;@called-by none
"RTN","SAMIUR2",1228,0)
 ;@calls
"RTN","SAMIUR2",1229,0)
 ; $$setroot^%wd
"RTN","SAMIUR2",1230,0)
 ;
"RTN","SAMIUR2",1231,0)
 new root set root=$$setroot^%wd("vapals-patients")
"RTN","SAMIUR2",1232,0)
 new sid set sid=$get(@root@(dfn,"samistudyid"))
"RTN","SAMIUR2",1233,0)
 new siform set siform=$get(SAMIPATS(zdt,dfn,"siform"))
"RTN","SAMIUR2",1234,0)
 new vals set vals=$name(@root@("graph",sid,siform))
"RTN","SAMIUR2",1235,0)
 new stat set stat=$get(@vals@("sistatus"))
"RTN","SAMIUR2",1236,0)
 ;
"RTN","SAMIUR2",1237,0)
 quit stat ; end of $$STATUS
"RTN","SAMIUR2",1238,0)
 ;
"RTN","SAMIUR2",1239,0)
 ;
"RTN","SAMIUR2",1240,0)
 ;
"RTN","SAMIUR2",1241,0)
WSVALS(RTN,FILTER) ; display form values from graph
"RTN","SAMIUR2",1242,0)
 ;
"RTN","SAMIUR2",1243,0)
 ;;web service;procedure;clean;silent;sac
"RTN","SAMIUR2",1244,0)
 ;@called-by none
"RTN","SAMIUR2",1245,0)
 ;@calls
"RTN","SAMIUR2",1246,0)
 ; $$setroot^%wd
"RTN","SAMIUR2",1247,0)
 ; wsGtree^SYNVPR
"RTN","SAMIUR2",1248,0)
 ;
"RTN","SAMIUR2",1249,0)
 new root set root=$$setroot^%wd("vapals-patients")
"RTN","SAMIUR2",1250,0)
 new sid set sid=$get(FILTER("sid"))
"RTN","SAMIUR2",1251,0)
 if sid="" set sid=$get(FILTER("studyid"))
"RTN","SAMIUR2",1252,0)
 quit:sid=""
"RTN","SAMIUR2",1253,0)
 ;
"RTN","SAMIUR2",1254,0)
 new zform set zform=$get(FILTER("form"))
"RTN","SAMIUR2",1255,0)
 new groot
"RTN","SAMIUR2",1256,0)
 if zform="" set groot=$name(@root@("graph",sid))
"RTN","SAMIUR2",1257,0)
 else  set groot=$name(@root@("graph",sid,zform))
"RTN","SAMIUR2",1258,0)
 set FILTER("root")=$extract(groot,2,$length(groot))
"RTN","SAMIUR2",1259,0)
 ;
"RTN","SAMIUR2",1260,0)
 do wsGtree^SYNVPR(.RTN,.FILTER)
"RTN","SAMIUR2",1261,0)
 ;
"RTN","SAMIUR2",1262,0)
 quit  ; end of ws WSVALS^SAMIUR2
"RTN","SAMIUR2",1263,0)
 ;
"RTN","SAMIUR2",1264,0)
 ;
"RTN","SAMIUR2",1265,0)
 ;
"RTN","SAMIUR2",1266,0)
EOR ; end of routine SAMIUR2
"RTN","SAMIURUL")
0^3^B102189
"RTN","SAMIURUL",1,0)
SAMIURUL ;ven/gpl - user reports log ;2021-09-09T01:12Z
"RTN","SAMIURUL",2,0)
 ;;18.0;SAMI;**12,14**;2020-01;Build 4
"RTN","SAMIURUL",3,0)
 ;;18.14
"RTN","SAMIURUL",4,0)
 ;
"RTN","SAMIURUL",5,0)
 ; SAMIURUL contains the development log & module documentation for
"RTN","SAMIURUL",6,0)
 ; the VAPALS-ELCAP user-reports routines SAMIUR & SAMIUR2.
"RTN","SAMIURUL",7,0)
 ;
"RTN","SAMIURUL",8,0)
 quit  ; no entry from top
"RTN","SAMIURUL",9,0)
 ;
"RTN","SAMIURUL",10,0)
 ;
"RTN","SAMIURUL",11,0)
 ;
"RTN","SAMIURUL",12,0)
 ;@section 0 primary development
"RTN","SAMIURUL",13,0)
 ;
"RTN","SAMIURUL",14,0)
 ;
"RTN","SAMIURUL",15,0)
 ;
"RTN","SAMIURUL",16,0)
 ;@routine-credits
"RTN","SAMIURUL",17,0)
 ;@dev-main Frederick D. S. Marshall (toad)
"RTN","SAMIURUL",18,0)
 ; toad@vistaexpertise.net
"RTN","SAMIURUL",19,0)
 ;@dev-org-main Vista Expertise Network (ven)
"RTN","SAMIURUL",20,0)
 ; http://vistaexpertise.net
"RTN","SAMIURUL",21,0)
 ;@copyright 2021, mcglk & toad, all rights reserved
"RTN","SAMIURUL",22,0)
 ;@license see routine SAMIUL
"RTN","SAMIURUL",23,0)
 ;
"RTN","SAMIURUL",24,0)
 ;@last-update 2021-09-09T01:12Z
"RTN","SAMIURUL",25,0)
 ;@application Screening Applications Management (SAM)
"RTN","SAMIURUL",26,0)
 ;@module Screening Applications Management - IELCAP (SAMI)
"RTN","SAMIURUL",27,0)
 ;@suite-of-files SAMI Forms (311.101-311.199)
"RTN","SAMIURUL",28,0)
 ;@version 18.14
"RTN","SAMIURUL",29,0)
 ;@release-date 2020-01
"RTN","SAMIURUL",30,0)
 ;@patch-list **12,14**
"RTN","SAMIURUL",31,0)
 ;
"RTN","SAMIURUL",32,0)
 ;@dev-add Kenneth McGlothlen (mcglk)
"RTN","SAMIURUL",33,0)
 ; mcglk@vistaexpertise.net
"RTN","SAMIURUL",34,0)
 ;@dev-add Linda M. R. Yaw (lmry)
"RTN","SAMIURUL",35,0)
 ; lmry@vistaexpertise.net
"RTN","SAMIURUL",36,0)
 ;
"RTN","SAMIURUL",37,0)
 ;@module-credits
"RTN","SAMIURUL",38,0)
 ;@project VA Partnership to Increase Access to Lung Screening
"RTN","SAMIURUL",39,0)
 ; (VA-PALS)
"RTN","SAMIURUL",40,0)
 ; http://va-pals.org/
"RTN","SAMIURUL",41,0)
 ;@funding 2017/2021, Bristol-Myers Squibb Foundation (bmsf)
"RTN","SAMIURUL",42,0)
 ; https://www.bms.com/about-us/responsibility/bristol-myers-squibb-foundation.html
"RTN","SAMIURUL",43,0)
 ;@partner-org Veterans Affairs Office of Rural health
"RTN","SAMIURUL",44,0)
 ; https://www.ruralhealth.va.gov/
"RTN","SAMIURUL",45,0)
 ;@partner-org International Early Lung Cancer Action Program (I-ELCAP)
"RTN","SAMIURUL",46,0)
 ; http://ielcap.com/
"RTN","SAMIURUL",47,0)
 ;@partner-org Paraxial Technologies (par)
"RTN","SAMIURUL",48,0)
 ; http://paraxialtech.com/
"RTN","SAMIURUL",49,0)
 ;@partner-org Open Source Electronic Health Record Alliance (OSEHRA)
"RTN","SAMIURUL",50,0)
 ; https://www.osehra.org/groups/va-pals-open-source-project-group
"RTN","SAMIURUL",51,0)
 ;
"RTN","SAMIURUL",52,0)
 ;@module-log repo github.com:VA-PALS-ELCAP/SAMI-VAPALS-ELCAP.git
"RTN","SAMIURUL",53,0)
 ;
"RTN","SAMIURUL",54,0)
 ; 2020-02-10/12 ven/gpl 18.0-t4 d543f7bb,f9869dfb,0e4d8b9a,5e67489f
"RTN","SAMIURUL",55,0)
 ;  SAMIUR,SAMIUR2 1st version of revised user reports, progress on
"RTN","SAMIURUL",56,0)
 ; user reports, fixed a bug in enrollment report, add rural/urban &
"RTN","SAMIURUL",57,0)
 ; compute.
"RTN","SAMIURUL",58,0)
 ;
"RTN","SAMIURUL",59,0)
 ; 2020-02-18 ven/lgc 18.0-t4 76874314
"RTN","SAMIURUL",60,0)
 ;  SAMIUR update recently edited routines.
"RTN","SAMIURUL",61,0)
 ;
"RTN","SAMIURUL",62,0)
 ; 2020-03-10/12 ven/gpl 18.0-t4 8de06b06,4ad52d64
"RTN","SAMIURUL",63,0)
 ;  SAMIUR user report date filtering, fix end date logic in UR.
"RTN","SAMIURUL",64,0)
 ;
"RTN","SAMIURUL",65,0)
 ; 2019-03-24/28 ven/gpl 18.0-t4 1fd4a4c8,0cebb36b
"RTN","SAMIURUL",66,0)
 ;  SAMIUR2 revise incomplete form report, remove ethnicity from
"RTN","SAMIURUL",67,0)
 ; enrollment report (we can't get it).
"RTN","SAMIURUL",68,0)
 ;
"RTN","SAMIURUL",69,0)
 ; 2020-04-16/23 ven/lgc 18.0-t4 e54b76d1b,89bffd3b
"RTN","SAMIURUL",70,0)
 ;  SAMIUR SAMIFRM2 > SAMIFORM, SAMISUB2 > LOAD.
"RTN","SAMIURUL",71,0)
 ;
"RTN","SAMIURUL",72,0)
 ; 2019-05-08 ven/lgc 18.0 2172e512
"RTN","SAMIURUL",73,0)
 ;  SAMIUR2 remove blank last line.
"RTN","SAMIURUL",74,0)
 ;
"RTN","SAMIURUL",75,0)
 ; 2019-06-21 par/dom 18.0 c6a4a57f VAP-352
"RTN","SAMIURUL",76,0)
 ;  SAMIUR2 proper spelling of "follow up."
"RTN","SAMIURUL",77,0)
 ;
"RTN","SAMIURUL",78,0)
 ; 2019-08-03/04 ven/gpl 18.0 ffc94f65,d03557d4,cd865e2b VPA-438
"RTN","SAMIURUL",79,0)
 ;  SAMIUR requested changes to followup report.
"RTN","SAMIURUL",80,0)
 ;  SAMIUR2 fix smoking status on enrollment report, fix change log
"RTN","SAMIURUL",81,0)
 ; display, add pack years at intake to enrollment report, add
"RTN","SAMIURUL",82,0)
 ; requested changes to followup report.
"RTN","SAMIURUL",83,0)
 ;
"RTN","SAMIURUL",84,0)
 ; 2019-09-26 ven/gpl 18.0 92b12324 VAP-420
"RTN","SAMIURUL",85,0)
 ;  SAMIUR add smoking history.
"RTN","SAMIURUL",86,0)
 ;  SAMIUR2 smoking history, new cummulative packyear processing.
"RTN","SAMIURUL",87,0)
 ;
"RTN","SAMIURUL",88,0)
 ; 2019-10-01 par/dom 18.0 4caf1a98 VAP-344
"RTN","SAMIURUL",89,0)
 ;  SAMIUR2 make capitalization consistent.
"RTN","SAMIURUL",90,0)
 ;
"RTN","SAMIURUL",91,0)
 ; 2020-01-01/05 ven/arc 18.0 399f8547,62e3200f
"RTN","SAMIURUL",92,0)
 ;  SAMIUR unmatched participant processing.
"RTN","SAMIURUL",93,0)
 ;  SAMIUR2 add unmatched patient processing.
"RTN","SAMIURUL",94,0)
 ;
"RTN","SAMIURUL",95,0)
 ; 2020-01-10 ven/gpl 18.0 1590577c
"RTN","SAMIURUL",96,0)
 ;  SAMIUR2 fix return on RACE^SAMIUR2 for cache.
"RTN","SAMIURUL",97,0)
 ;
"RTN","SAMIURUL",98,0)
 ; 2020-04-29/05-13 ven/gpl 18.5 e8b8ea2d,61c7d208
"RTN","SAMIURUL",99,0)
 ;  SAMIUR fixes for reports, worklist functionality.
"RTN","SAMIURUL",100,0)
 ;
"RTN","SAMIURUL",101,0)
 ; 2020-05-13/14 ven/gpl 18.5 61c7d208,b05df417
"RTN","SAMIURUL",102,0)
 ;  SAMIUR2 add worklist functionality, fix gender & dob detection on
"RTN","SAMIURUL",103,0)
 ; reports.
"RTN","SAMIURUL",104,0)
 ;
"RTN","SAMIURUL",105,0)
 ; 2021-03-22/23 ven/gpl 18.10 256efe63,ba81b86a
"RTN","SAMIURUL",106,0)
 ;  SAMIUR sort all reports by name, added row totals to reports.
"RTN","SAMIURUL",107,0)
 ;
"RTN","SAMIURUL",108,0)
 ; 2021-03-23 ven/toad 18.10 96f461d0,af86e0eb
"RTN","SAMIURUL",109,0)
 ;  SAMIUR add version info & dev log, lt refactor, fix XINDEX
"RTN","SAMIURUL",110,0)
 ; errors.
"RTN","SAMIURUL",111,0)
 ;
"RTN","SAMIURUL",112,0)
 ; 2021-03-29 ven/gpl 18.11 e809f2a2
"RTN","SAMIURUL",113,0)
 ;  SAMIUR prevent crash when reports have no matches: in WSREPORT
"RTN","SAMIURUL",114,0)
 ; set SRT="" and uncomment zwrite SRT; in WKLIST add 2 commented-out
"RTN","SAMIURUL",115,0)
 ; debugging lines.
"RTN","SAMIURUL",116,0)
 ;
"RTN","SAMIURUL",117,0)
 ; 2021-03-30 ven/toad 18.11 7b14bb29
"RTN","SAMIURUL",118,0)
 ;  SAMIUR bump version, date, log; in WSREPORT comment zwrite SRT.
"RTN","SAMIURUL",119,0)
 ;
"RTN","SAMIURUL",120,0)
 ; 2021-03-31 ven/gpl 18.11 66d89cde
"RTN","SAMIURUL",121,0)
 ;  SAMIUR sort on all uppercase names for reports
"RTN","SAMIURUL",122,0)
 ;
"RTN","SAMIURUL",123,0)
 ; 2021-04-13 ven/gpl 18.11 a12765bf,f09ffef9,fb399aba
"RTN","SAMIURUL",124,0)
 ;  SAMIUR inactive report created.
"RTN","SAMIURUL",125,0)
 ;  SAMIUR2 in RPTTBL,GENDER create inactive report, move last exam
"RTN","SAMIURUL",126,0)
 ; column on followup report, fix gender being blank in reports.
"RTN","SAMIURUL",127,0)
 ;
"RTN","SAMIURUL",128,0)
 ; 2021-05-20/25 ven/mcglk&toad 18.11 43a4557c,70fc6ba3,129e96b1,
"RTN","SAMIURUL",129,0)
 ; cee2bf17
"RTN","SAMIURUL",130,0)
 ;  SAMIUR annotate, lt refactor, bump version.
"RTN","SAMIURUL",131,0)
 ;  SAMIUR2 passim hdr comments, chg log, annotate, refactor, bump
"RTN","SAMIURUL",132,0)
 ; version.
"RTN","SAMIURUL",133,0)
 ;
"RTN","SAMIURUL",134,0)
 ; 2021-05-29 ven/gpl 18.12-t2 e6fd5730,a3d6f9a0
"RTN","SAMIURUL",135,0)
 ;  SAMIUR,SAMIUR2 ssn params & matching report, update unmatched
"RTN","SAMIURUL",136,0)
 ; report headings.
"RTN","SAMIURUL",137,0)
 ;
"RTN","SAMIURUL",138,0)
 ; 2021-06-15 ven/gpl 18.12-t2 7e481426
"RTN","SAMIURUL",139,0)
 ;  SAMIUR add site to editperson navigation.
"RTN","SAMIURUL",140,0)
 ;
"RTN","SAMIURUL",141,0)
 ; 2021-06-28 ven/gpl 18.12-t2 df0aaea1,1137e2bb
"RTN","SAMIURUL",142,0)
 ;  SAMIUR change definition of inactive to not marked active, change
"RTN","SAMIURUL",143,0)
 ; definition of active to marked active.
"RTN","SAMIURUL",144,0)
 ;
"RTN","SAMIURUL",145,0)
 ; 2021-07-06 ven/mcglk&toad&gpl 18.12-t2 cbf7e46b,2d642aa4,
"RTN","SAMIURUL",146,0)
 ; b248664b
"RTN","SAMIURUL",147,0)
 ;  SAMIURUL new routine for dev log.
"RTN","SAMIURUL",148,0)
 ;  SAMIUR,SAMIUR2,SAMIURUL move dev log & module docs to SAMIURUL,
"RTN","SAMIURUL",149,0)
 ; bump version & dates.
"RTN","SAMIURUL",150,0)
 ;  SAMIUR in SELECT r/inactive w/status, test for active instead of
"RTN","SAMIURUL",151,0)
 ; inactive.
"RTN","SAMIURUL",152,0)
 ;
"RTN","SAMIURUL",153,0)
 ; 2021-07-12 ven/gpl 18.12-t3 60f4bb05,27c40485,d35bcb46
"RTN","SAMIURUL",154,0)
 ;  SAMIUR in WSREPORT,SORT add contact date & entry to missingct
"RTN","SAMIURUL",155,0)
 ; report.
"RTN","SAMIURUL",156,0)
 ;  SAMIUR2 add contact date & entry to missingct report; add
"RTN","SAMIURUL",157,0)
 ; inactive date reason & comment to inactive report; chg inactive
"RTN","SAMIURUL",158,0)
 ; date to date of death.
"RTN","SAMIURUL",159,0)
 ;
"RTN","SAMIURUL",160,0)
 ; 2021-08-01 ven/gpl 18.12 5bd7c627
"RTN","SAMIURUL",161,0)
 ;  SAMIUR set intake form to incomplete on creation: in SELECT if
"RTN","SAMIURUL",162,0)
 ; type="incomplete" ensure default status is incomplete.
"RTN","SAMIURUL",163,0)
 ;
"RTN","SAMIURUL",164,0)
 ; 2021-08-11 ven/gpl 18.12 4d4f0fc3
"RTN","SAMIURUL",165,0)
 ;  SAMIUR,SAMIUR2 add sorting to tables used for reports
"RTN","SAMIURUL",166,0)
 ;  SAMIUR in WSREPORT,NUHREF,WKLIST.
"RTN","SAMIURUL",167,0)
 ;  SAMIUR2 in TDDT,BLINEDT,DOB,FUDATE,LASTEXM,INACTDT,LDOC,STUDYDT
"RTN","SAMIURUL",168,0)
 ;
"RTN","SAMIURUL",169,0)
 ; 2021-08-26 ven/gpl 18.14 de044cf9
"RTN","SAMIURUL",170,0)
 ; SAMIUR, SAMIUR2 make changes to user reports as requested.
"RTN","SAMIURUL",171,0)
 ; Reports changed were Enrollment, Activity, and Follow-up.
"RTN","SAMIURUL",172,0)
 ;
"RTN","SAMIURUL",173,0)
 ; 2021-08-28 ven/gpl 18.14
"RTN","SAMIURUL",174,0)
 ; SAMIUR, SAMIUR2 fix bugs causing Activity report to work incorrectly.
"RTN","SAMIURUL",175,0)
 ; Also fixed problem with Work List.
"RTN","SAMIURUL",176,0)
 ;
"RTN","SAMIURUL",177,0)
 ; 2021-09-09 ven/gpl 18.14
"RTN","SAMIURUL",178,0)
 ; SAMIUR fix bugs in reports showing inactive patients on wrong reports,
"RTN","SAMIURUL",179,0)
 ; "baseline" showing up in F/U date on Follow-up report, wrong patients
"RTN","SAMIURUL",180,0)
 ; on Intake but Missing CT Eval report.
"RTN","SAMIURUL",181,0)
 ;
"RTN","SAMIURUL",182,0)
 ;
"RTN","SAMIURUL",183,0)
 ;@contents
"RTN","SAMIURUL",184,0)
 ; SAMIUR user reports
"RTN","SAMIURUL",185,0)
 ; SAMIUR2 user reports cont
"RTN","SAMIURUL",186,0)
 ; SAMIURUL user reports log
"RTN","SAMIURUL",187,0)
 ;
"RTN","SAMIURUL",188,0)
 ; SAMIUR1 [to be added]
"RTN","SAMIURUL",189,0)
 ;
"RTN","SAMIURUL",190,0)
 ;
"RTN","SAMIURUL",191,0)
 ;
"RTN","SAMIURUL",192,0)
EOR ; end of SAMIURUL
"VER")
8.0^22.2
**END**
**END**
