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

BWUPRNI.m

Go to the documentation of this file.
BWUPRNI ;IHS/ANMC/MWR - UPLOAD: RESULTS FROM CORNING;15-Feb-2003 22:13;PLS
 ;;2.0;WOMEN'S HEALTH;**8**;MAY 16, 1996
 ;;* MICHAEL REMILLARD, DDS * ALASKA NATIVE MEDICAL CENTER *
 ;;  CONVERTS NICHOL'S LAB RESULTS FROM FIXED TO VARIABLE, THEN FORMATS
 ;;  REPORTS AND PLACES THEM IN BW PROCEDURE FILE (WP) WITH PATIENTS.
 ;
 ;---> * FOR CORNING LAB *
 ;
 ;---> CONVERSION AND TRANSFER OF RESULTS FOR * CORNING LAB *.
 ;---> THIS ROUTINE IS CALLED BY ^BWUPLD. "CVT" CONVERTS CORNING LAB
 ;---> FIXED LENGTH ASCII TEXT LAB RESULTS ABBREVIATIONS INTO VARIABLE
 ;---> RECORDS AND ADDS THEM TO THE "BW UPLD RESULTS TEMP (CORNING)"
 ;---> FILE.
 ;--->
 ;---> "TRANS" FORMATS AND TRANSFERS ENTRIES FROM THE "BW UPLD RESULTS
 ;---> TEMP (CORNING)" FILE INTO THE WP FIELD OF THE "BW PROCEDURE"
 ;---> FILE.  MATCHING IS DONE ON THE BASIS OF THE ACCESSION#, THE "B"
 ;---> CROSSREFERENCE AND THEN CHART# FOR IHS, SSN# FOR NON-IHS.
 ;
CVT(LINE,PIECE) ;EP
 ;---> COVERT FIXED LENGTH INTO "^" DELIMITED VARIABLE LENGTH.
 ;---> PIECE=1 SAYS PIECE BWLINE WHEN RETURNED TO BWUPLD.
 N Y,Z
 ;---> TRANSLATE ALL "^" INTO "`".
 S Y=$TR(LINE,"^","`")
 ;---> EXTRACT THE ACCESSION#, TRIM OFF ANY TRAILING SPACES.
 S Z=$$TRIM($E(Y,106,117))
 ;---> IF ACCESSION#="", SET ACC#=NICHOL'S REQUISITION#.
 S:Z']"" Z=$$TRIM($E(Y,47,62))
 ;---> EXTRACT THE PATIENT NAME, TRIM TRAILING SPACES.
 S Z=Z_U_$$TRIM($E(Y,9,32))
 ;---> EXTRACT THE PATIENT SSN/ACCT#, TRIM TRAILING SPACES.
 S Z=Z_U_$$TRIM($E(Y,33,46))
 ;---> EXTRACT THE REQUISITION#, TRIM TRAILING SPACES.
 S Z=Z_U_$$TRIM($E(Y,47,62))
 ;---> EXTRACT THE DATE OF BIRTH.
 S Z=Z_U_$$TRIM($E(Y,63,72))
 ;---> EXTRACT THE AGE.
 S Z=Z_U_$$TRIM($E(Y,73,76))
 ;---> EXTRACT THE HOSPITAL ID#/CHART#, TRIM TRAILING SPACES.
 S Z=Z_U_$$TRIM($E(Y,77,88))
 ;---> EXTRACT THE REFERRING PHYSICIAN, TRIM TRAILING SPACES.
 S Z=Z_U_$$TRIM($E(Y,89,105))
 ;---> EXTRACT THE ACCOUNT#, TRIM TRAILING AND LEADING SPACES.
 S Z=Z_U_$$TRIM2($$TRIM($E(Y,1,8)))
 ;---> EXTRACT THE TEST NAME, TRIM TRAILING SPACES.
 S Z=Z_U_$$TRIM($E(Y,118,139))
 ;---> EXTRACT THE COLLECTION DATE.
 S Z=Z_U_$$TRIM($E(Y,140,147))
 ;---> EXTRACT THE LOCATION.
 S Z=Z_U_$$TRIM($E(Y,148,153))
 ;---> EXTRACT THE SPECIMEN SOURCE, TRIM TRAILING SPACES.
 S Z=Z_U_$$TRIM($E(Y,154,178))
 ;---> EXTRACT THE SPECIMEN ADEQUACY, TRIM TRAILING SPACES.
 S Z=Z_U_$$TRIM($E(Y,179,203))
 ;---> EXTRACT THE GENERAL CATEGORIZATION, TRIM TRAILING SPACES.
 S Z=Z_U_$$TRIM($E(Y,204,228))
 ;---> EXTRACT THE DESCRIPTIVE DIAGNOSIS, TRIM TRAILING SPACES.
 S Z=Z_U_$$TRIM($E(Y,229,253))
 ;---> EXTRACT THE SQUAMOUS CELLS, TRIM TRAILING SPACES.
 S Z=Z_U_$$TRIM($E(Y,254,278))
 ;---> EXTRACT THE GLANDULAR CELLS, TRIM TRAILING SPACES.
 S Z=Z_U_$$TRIM($E(Y,279,303))
 ;---> EXTRACT THE REACTIVE/REPAIRATIVE, TRIM TRAILING SPACES.
 S Z=Z_U_$$TRIM($E(Y,304,328))
 ;---> EXTRACT THE INFECTION, TRIM TRAILING SPACES.
 S Z=Z_U_$$TRIM($E(Y,329,353))
 ;---> EXTRACT THE INFECTION NOTATION, TRIM TRAILING SPACES.
 S Z=Z_U_$$TRIM($E(Y,354,378))
 ;---> EXTRACT THE HORMONAL EVALUATION, TRIM TRAILING SPACES.
 S Z=Z_U_$$TRIM($E(Y,379,403))
 ;---> EXTRACT THE HORMONAL EVALUATION NOTATION, TRIM TRAILING SPACES.
 S Z=Z_U_$$TRIM($E(Y,404,428))
 ;---> EXTRACT THE COMMENT, TRIM TRAILING SPACES.
 S Z=Z_U_$$TRIM($E(Y,429,453))
 ;---> EXTRACT THE REVIEWER, TRIM TRAILING SPACES.
 S LINE=Z_U_$$TRIM($E(Y,454,478)),PIECE=1
 Q
 ;
TRIM(X) ;EP
 ;---> TRIM OFF ANY TRAILING SPACES.
 Q:'$D(X) ""
 N L S L=$L(X)
 F  Q:$E(X,L)'=" "  S L=L-1
 Q $E(X,1,L)
 ;
TRIM2(X) ;EP
 ;---> TRIM OFF ANY LEADING SPACES.
 Q:'$D(X) ""
 N I,L S L=$L(X)
 F I=1:1 Q:$E(X,I)'=" "
 Q $E(X,I,L)
 ;
 ;
TRANS ;EP
 ;---> * FOR CORNING LAB *
 ;---> "TRANS" FORMATS AND TRANSFERS ENTRIES FROM THE "BW UPLD RESULTS
 ;---> TEMP (CORNING)" FILE INTO THE WP FIELD OF THE "BW PROCEDURE"
 ;---> FILE.  MATCHING IS DONE ON THE BASIS OF THE ACCESSION#, THE "B"
 ;---> CROSSREFERENCE.
 ;---> BWY WILL EQUAL THE IEN OF THE PROCEDURE, FILE 9002086.1.
 ;---> BWYY WILL EQUAL THE IEN OF THE LAB RESULT, FILE 9002086.82.
 N BWAGENCY,BWDFN,BWHRCN,BWSSN,BWY,BWYY
 S (BWMATCH,BWNOMAT)=0,BWTAB="                    "
 W !?5,"Transferring to ""BW PROCEDURE"" FILE..." H 1
 S BWYY=0
 F  S BWYY=$O(^BWRNI(BWYY)) Q:'BWYY  D
 .;---> GET ACCESSION#, CHART#, AND SSN# FROM LAB RESULT.
 .S BWACC=$P(^BWRNI(BWYY,0),U),BWHRCN=$P(^(0),U,7),BWSSN=$P(^(0),U,3)
 .;
 .;---> GET IEN OF THE PROCEDURE, FILE 9002086.1, FOR THIS ACCESSION#.
 .S BWY=$O(^BWPCD("B",BWACC,0))
 .;
 .;---> XREF FAILED TO PRODUCE IEN IN PROCEDURE FILE (^BWPCD).
 .I BWY="" D NOMATCH^BWUPTRAN(BWYY,1) Q
 .I '$D(^BWPCD(BWY,0)) D NOMATCH^BWUPTRAN(BWYY,1) Q
 .;
 .;---> GET DFN AND AGENCY (IHS, STATE, OR VA).
 .S BWDFN=$P(^BWPCD(BWY,0),U,2)
 .S BWAGENCY=$$AGENCY^BWUTL5(DUZ(2))
 .;
 .;---> IF AGENCY IS IHS AND THE CHART# FOR THIS RESULT DOES NOT
 .;---> MATCH CHART# FOR THIS PATIENT, STORE RESULT AS UNMATCHED.
 .I BWAGENCY="i",$$HRCN1^BWUTL1(BWDFN,DUZ(2))'=+BWHRCN D  Q
 ..D NOMATCH^BWUPTRAN(BWYY,3)
 .;
 .;---> FOR NON-IHS AGENCY, IF SSN# FOR THIS RESULT DOES NOT
 .;---> MATCH SSN# FOR THIS PATIENT, STORE RESULT AS UNMATCHED.
 .I BWAGENCY'="i",$$SSN^BWUTL1(BWDFN)'=+BWSSN D  Q
 ..D NOMATCH^BWUPTRAN(BWYY,6)
 .;
 .;---> TEXT ALREADY STORED FOR THIS IEN IN PROCEDURE FILE (^BWPCD).
 .I $O(^BWPCD(BWY,1,0)) D NOMATCH^BWUPTRAN(BWYY,2) Q
 .;
 .;---> TRANSFER THIS LAB RESULT INTO IT'S PROCEDURE.
 .D TRANSFER^BWUPTRAN(BWYY,BWY)
 .;
 W !?5,"Number of results successfully matched: ",BWMATCH
 W !?5,"Number of results NOT matched.........: ",BWNOMAT,!
 Q