SDES2UTIL ;ALB/MGD,ANU,TJB,BWF,MGD,MCB,JHV,MCB,LAB - SDES2 UTILITIES ;MAY 05, 2025
Source file <SDES2UTIL.m>
| Name | Comments | DBIA/ICR reference | 
|---|---|---|
| PADCLTIME(TIME) | ;
 ; TIME - Time to Pad  | 
|
| PADFMTIME(TIME) | ;
 ; TIME - Time to Pad  | 
|
| PADLENGTH(STRING,CHAR,LENGTH,WHERE) | ;
 | 
|
| VALACHERONID(SDACHERONID) | ;
 | 
|
| STRIP(SDECZ) | ;Replace control characters with spaces
 | 
|
| ISDATEDST(DATE,DSTSUM) | ;Does this date use Daylight Savings
 ; DATE - FM format ; DSTSUM - "DST" or "SUM" ; Return 1 = DATE is considered DST or SUM ; 0 = DATE is not DST and not SUM ; -1 = DATE is not FM format  | 
|
| DSTSTART(YR,DSTSUM) | ;Daylight Savings or Summer start date
 ; countries that observe DST or Summer ST (e.g., USA observes DST and Europe observes SUM ST) ; YR - 2 digit year ; DSTSUM - "DST" or "SUM" ; Return is the FM date for the FIRST day of DST or SUM  | 
|
| DSTEND(YR,DSTSUM) | ;Daylight Savings END date
 ; YR - 2 digit year ; DSTSUM - "DST" or "SUM" ; Return is the FM date for the LAST day of DST or SUM  | 
|
| SUMMER(DSTDT,DOW,SUNDAY) | ; determine last Sunday of MARCH or OCTOBER
 ; DSTDT - March or October (e.g, CYY0301 or CYY1001) ; DOW - 1, 2, 3, 4, 5, or 6 ; SUNDAY - "4,5" representing 4th or 5th Sunday of March or October ; Returns the date when SUMMER offset begins or ends (e.g., eastern Europe uses Summer offset)  | 
|
| TIMEZONEDATA(CLINICIEN) | ;Get timezone and offsets
 ; CLINIC - IEN from Hospital Location #44 ; If clinic is not passed, use default Facility/Institution ; Output: ; Returns TimeZone Name ^ TimeZone IEN ^ TimeZone Exception ^ Offset for Standard Time ^ Offset for DST or SUMMER ^  | 
|
| GETTZOFFSET(SDDATE,SDCLINIC) | ;Get Time Zone offset based on clinic and daylight savings
 ; SDCLINIC - OPT - IEN from Hospital Location #44 ; SDDATE - REQ - FM formatted date ; Return ; If clinic is passed in get Division then Institution ; Otherwise get Institution from Kernel System Parameters ; Get the Time Zone and Time Zone Exception from the Institution  | 
|
| CHAR4(CLINNAME) | ;
 ; CLINNAME - REQ - Name of clinic from #44 ; Return ; The CODE (#.01) field from NATIONAL CLINIC (#728.411) file or null  | 
|
| TELEPHONE(PHONE) | ; Format all numeric Telephone Number
 ; PHONE - The Telephone Number ; Return ; If PHONE is all numeric it will be formatted as follows ; 1234567890 will be formatted as (123)456-7890 ; otherwise the passed in PHONE is returned.  | 
|
| EXT(EXT) | ; Add an x to the beginning of an all numeric Telephone Extension field.
 ; EXT - The Telephone Extension. ; Return ; If EXT is all numeric, a lowercase x concantenated to the passed in EXT. ; otherwise the passed in EXT is returned.  | 
|
| INACTIVE(SDCL,SDDT) | ; determine if clinic is active
 ; Input: ; SDCL = (Req) IEN of Clinic from file #44. ; SDDT = (Opt) Date to use for determining Status. If not passed in, defaults to DT. ; Return: ; 0=ACTIVE ; 1=INACTIVE  | 
|
| STATIONNUMBER(CLINICIEN) | ;
 ; Input: ; CLINICIEN (Opt) = IEN of the Clinic from File #44. If not passed in, the default ; Institution for the VistA Instance it used. ; Output: The STATION NUMBER (#99) field from the INSTITUTION (#4) file.  | 
|
| VALIDATEAMIS(AMIS,RESTYP) | ;
 ; Input: ; AMIS: The AMIS Stop Code to validate ; RESTYP: P:Primary, C:Credit ; Output: ; 0 = AMIS Stop Code is Valid ; # = Error number to log  | 
|
| PRIMARYAMIS(PRIAMIS,ERRORNUM) | ;
 | 
|
| SECONDARYAMIS(CREDITAMIS,ERRORNUM) | ;
 | 
|
| AMISTOSTOPCODE(AMIS) | ; Map from AMIS to Stop Code
 ; Input: AMIS = (Req) the AMIS REPORTING STOP CODE (#1) field from the CLINIC STOP (#40.7) file. ; Output: 0:validation failed, IEN for the Stop Code that matches to the passed in AMIS code.  | 
|
| STOPCODETOAMIS(STOPIEN) | ; Map from Stop Code IEN to AMIS Stop Code Number
 ; Input: STOPIEN = (Req) The IEN of the Stop Code in the CLINIC STOP (#40.7) file. ; Output: "": validation failed, IEN for the AMIS REPORTING STOP CODE (#1).  | 
|
| RESCHKFAILED(STOPCODEIEN,RESTYPE) | ;
 ; Input: STOPCODEIEN (Req) IEN from CLINIC STOP (#40.7) file. ; RESTYPE (Req) P for Primary or S for Credit ; Output: 0: Restriction checks passed, 1: Restriction checks failed  | 
|
| STOPCODEINACTIVE(SDAMISSTOPCODE,SDTYPE) | ;
 ; SDAMISSTOPCODE = IEN of Stop Code  | 
|
| SOCINT2EXT(FILE,FLD,INTVAL) | ;
 | 
|
| SOCEXT2INT(FILE,FLD,EXTVAL) | ;
 | 
|
| CHECKYN(VAR) | ;
 | 
|
| CHECKYNBLANKDEL(VAR) | ;
 | 
|
| YNTOBOOL(VAR) | ;convert a Y/N input param to 1 or 0
 | 
|
| CHECKFORDEL(SDERRORS,SDINPUTARRAY) | ; Check top level array entries for @
 | 
|
| CHECKFORDELMULT(SDERRORS,SDINPUTARRAY) | ; Check subfile array entries for @
 | 
|
| SENSITIVE(RESULT,DFN,SDDUZ,DGMSG,DGOPT) | ;RPC/API entry point for patient sensitive & record access checks
 | 
|
| GETSUB(TXT) | ||
| FILEMANTOHL7(FILEMANDATETIME,DATEWITHOFFSET) | ;Convert FM date/time to HL7 format - supported ICR #10103
 | 
| FileNo | Call Tags | 
|---|---|
| 1.711 | GETS^DIQ | 
| ^DIC(4 - [#4] | GET1^DIQ | 
| ^DIC(40.7 - [#40.7] | GET1^DIQ | 
| ^DG(40.8 - [#40.8] | GET1^DIQ | 
| ^SC - [#44] | GET1^DIQ | 
| ^ECX(728.44 - [#728.44] | FIND1^DIC, GET1^DIQ | 
| ^XTV(8989.3 - [#8989.3] | GET1^DIQ |