Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: EASEZT1

EASEZT1.m

Go to the documentation of this file.
  1. EASEZT1 ;ALB/jap - Data Transformation Logic for 1010EZ Processing ;10/12/00 13:08
  1. ;;1.0;ENROLLMENT APPLICATION SYSTEM;**51,70**;Mar 15, 2001;Build 26
  1. ;
  1. ;
  1. NAME(EASAPP,TYPE,MULTIPLE) ;get full name for person of interest
  1. ;input EASAPP = application ien in file #712
  1. ; TYPE = "APPLICANT", "SPOUSE", "CHILD1", "CHILD(N)", "NEXT-OF-KIN", "E-CONTACT"
  1. ; MULTIPLE = default to 1, unless TYPE="CHILD(N)"
  1. ;output NAME = LAST,FIRST MIDDLE SUFFIX
  1. ;
  1. ;sets entire name in Vista format;
  1. ;places result in the first data element associated with name;
  1. ;nulls unneeded ^TMP("EZDATA" nodes to avoid use in SORT^EASEZC3
  1. N RTR,KEY,NAME,LAST,FIRST,MDL,SUFF,T
  1. S NAME=""
  1. S KEY=+$$KEY711^EASEZU1(TYPE_" LAST NAME") I KEY D
  1. .S LAST=$P($$DATA712^EASEZU1(EASAPP,KEY,MULTIPLE),U,1)
  1. S KEY=+$$KEY711^EASEZU1(TYPE_" FIRST NAME") I KEY D
  1. .S FIRST=$P($$DATA712^EASEZU1(EASAPP,KEY,MULTIPLE),U,1)
  1. .F T=1,2 S ^TMP("EZDATA",$J,KEY,MULTIPLE,T)=""
  1. S KEY=+$$KEY711^EASEZU1(TYPE_" MIDDLE NAME") I KEY D
  1. .S MDL=$P($$DATA712^EASEZU1(EASAPP,KEY,MULTIPLE),U,1)
  1. .F T=1,2 S ^TMP("EZDATA",$J,KEY,MULTIPLE,T)=""
  1. S KEY=+$$KEY711^EASEZU1(TYPE_" SUFFIX NAME") I KEY D
  1. .S SUFF=$P($$DATA712^EASEZU1(EASAPP,KEY,MULTIPLE),U,1)
  1. .F T=1,2 S ^TMP("EZDATA",$J,KEY,MULTIPLE,T)=""
  1. I (LAST="")!(FIRST="") Q NAME
  1. S NAME=LAST_","_FIRST
  1. I $L(NAME)+$L(MDL)>45 S MDL=$E(MDL,1)
  1. I MDL'="" S NAME=NAME_" "_MDL
  1. I SUFF'="" S NAME=NAME_" "_SUFF
  1. S NAME=$$UC^EASEZT1($E(NAME,1,45))
  1. Q NAME
  1. ;
  1. SSNOUT(EASSSN) ;format ssn for output to display or print
  1. ; input EASSSN = 9 digit OR 9-digit+P ssn
  1. ; output SSN = nnn-nn-nnnn OR nnn-nn-nnnnP
  1. N SSN,P,X1,X2,X3
  1. I EASSSN="--" Q ""
  1. I $L(EASSSN)'=9 Q EASSSN
  1. S X1=$E(EASSSN,1,3),X2=$E(EASSSN,4,5),X3=$E(EASSSN,6,9),P=$E(EASSSN,10)
  1. S SSN=X1_"-"_X2_"-"_X3 I P="P" S SSN=SSN_P
  1. Q SSN
  1. ;
  1. UC(STRING) ;convert to uppercase
  1. ;input STRING = alpha character string; mixed-case
  1. ;output X = alpha character string; uppercase
  1. ;
  1. N %,X
  1. S X=STRING
  1. F %=1:1:$L(X) S:$E(X,%)?1L X=$E(X,0,%-1)_$C($A(X,%)-32)_$E(X,%+1,999)
  1. Q X
  1. ;
  1. XDATE(XDATE) ;check date
  1. ;input XDATE = external date mm/dd/yyyy where
  1. ; mm, dd, and /or yyyy may be null
  1. ;output XD = FM external date or null
  1. ;
  1. N X,XD,X1,X2,X3,Y,%DT
  1. I XDATE="//" Q ""
  1. S X1=$P(XDATE,"/",1),X2=$P(XDATE,"/",2),X3=$P(XDATE,"/",3)
  1. ;remove invalid portions
  1. I $L(X3)'=4 S X3=""
  1. I X1="" S X2=""
  1. I X3="" S X1="",X2=""
  1. ;if no month, day, year, then null
  1. I X1="",X2="",X3="" Q ""
  1. S X="" S:X1 X=X_X1_" " S:X2 X=X_X2_" " S X=X_X3
  1. ;convert to FM external format
  1. S %DT="P" D ^%DT
  1. D DD^%DT
  1. S XD=Y
  1. I XD=1699 S XD=""
  1. Q XD
  1. ;
  1. YN(XDATA) ;
  1. N X
  1. I $L(XDATA)>1 Q XDATA
  1. S X=$S(XDATA="Y":"YES",XDATA="N":"NO",1:"")
  1. Q X
  1. ;
  1. SEX(XDATA) ;
  1. N X
  1. I $L(XDATA)>1 Q XDATA
  1. S X=$S(XDATA="M":"MALE",XDATA="F":"FEMALE",1:"UNKNOWN")
  1. Q X
  1. ;
  1. STATE(XDATA) ;
  1. N X,XI
  1. I $L(XDATA)'=2 Q XDATA
  1. I XDATA="AS" Q "AMERICAN SAMOA"
  1. I XDATA="DC" Q "DISTRICT OF COLUMBIA"
  1. I XDATA="FM" Q "FEDERATED STATES OF MICRONESIA"
  1. I XDATA="GU" Q "GUAM"
  1. I XDATA="MH" Q "MARSHALL ISLANDS"
  1. I XDATA="MP" Q "NORTHERN MARIANA ISLANDS"
  1. I XDATA="PW" Q "PALAU (TRUST TERRITORY)"
  1. I XDATA="PR" Q "PUERTO RICO"
  1. I XDATA="VI" Q "VIRGIN ISLANDS"
  1. I XDATA="FG" Q "FOREIGN COUNTRY"
  1. S XI=$O(^DIC(5,"C",XDATA,0)) I 'XI Q XDATA
  1. S X=$P($G(^DIC(5,XI,0)),U,1)
  1. Q X
  1. ;
  1. COUNTY(EASAPP,XDATA) ;include county code
  1. ;this transform can only be used for APPLICANT COUNTY
  1. N X,ABBR,STATE,SIEN,CIEN,CCODE
  1. I XDATA="" Q XDATA
  1. S KEY=+$$KEY711^EASEZU1("APPLICANT STATE")
  1. I 'KEY Q XDATA
  1. S ABBR="",STATE="",SIEN="",CIEN="",CCODE=""
  1. I KEY D
  1. .S ABBR=$P($$DATA712^EASEZU1(EASAPP,KEY,1),U,1)
  1. .I ABBR'="" S STATE=$$STATE^EASEZT1(ABBR)
  1. .I STATE'="" S SIEN=$O(^DIC(5,"B",STATE,0))
  1. .I SIEN'="" S CIEN=$O(^DIC(5,SIEN,1,"B",XDATA,0))
  1. .I CIEN'="" S CCODE=$P($G(^DIC(5,SIEN,1,CIEN,0)),U,3)
  1. I CCODE'="" S XDATA=XDATA_" ("_CCODE_")"
  1. Q XDATA
  1. ;
  1. ETHNIC(XDATA) ;
  1. N X
  1. I ($L(XDATA)>1)!(XDATA="") Q XDATA
  1. S X=$S(XDATA="Y":"YES",XDATA="N":"NO",XDATA="U":"UNKNOWN",1:"")
  1. I X'="" S X=X_" (S)"
  1. Q X
  1. ;
  1. RACE(XDATA) ;
  1. N X
  1. I $L(XDATA)>1 Q XDATA
  1. S X=$S(XDATA="Y":"YES (S)",1:"")
  1. Q X
  1. ;
  1. LAST(XDATA) ; return LAST NAME, first middle
  1. Q $$UC($P($G(XDATA),","))
  1. ;
  1. COUNTRY(XDATA) ;
  1. ; Input: 3 character COUNTRY CODE (from file # 779.004)
  1. ; Output: POSTAL NAME, if it exists
  1. ; DESCRIPTION, if POSTAL NAME="<NULL>"
  1. ; -1, if invalid
  1. N RSLT
  1. S RSLT=$$COUNTRY^DGADDUTL(XDATA)
  1. Q $S(RSLT=-1:"",1:RSLT)
  1. ;