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

ONCSED01.m

Go to the documentation of this file.
  1. ONCSED01 ;HINES OIFO/SG - EDITS 'RUN BATCH' REQUEST ; 11/6/06 11:48am
  1. ;;2.2;ONCOLOGY;**1,16,19,20**;Jul 31, 2013;Build 5
  1. ;..P19
  1. ;P16 - hwsc encrytion function
  1. ;--- SOAP REQUST TO THE ONCOLOGY WEB SERVICE
  1. ;
  1. ; <?xml version="1.0" encoding="utf-8"?>
  1. ; <soap:Envelope
  1. ; xmlns:soap="http://www.w3.org/2001/12/soap-envelope"
  1. ; soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">
  1. ; <soap:Body>
  1. ; <ED-RUN-BATCH [edits-config="..."] ver="2.0"
  1. ; xmlns="http://vista.domain.ext/oncology">
  1. ; <NAACCR-RECORD> ... </NAACCR-RECORD>
  1. ; </ED-RUN-BATCH>
  1. ; </soap:Body >
  1. ; </soap:Envelope>
  1. ;
  1. ;--- ATTRIBUTES
  1. ;
  1. ; edits-config Name of the configuration that should be used by
  1. ; the server to validate the data. By default,
  1. ; the "DEFAULT" name is used.
  1. ;
  1. Q
  1. ;
  1. ;***** EXECUTES THE 'RUN BATCH' EDITS REQUEST
  1. ;
  1. ; [.ONCSAPI] Reference to the API descriptor (see ^ONCSAPI)
  1. ;
  1. ; .ONC8REQ Reference to a local variable that stores the
  1. ; closed root of the request.
  1. ;
  1. ; Sub-nodes of the variable are used internally
  1. ; (see ^ONCSNACR and ^ONCSAPIR for details).
  1. ;
  1. ; [ONC8MSG] Closed root of the buffer for error messages. By
  1. ; default ($G(ONC8MSG)=""), the ^TMP("ONCSED01M",$J)
  1. ; global node is used.
  1. ;
  1. ; @ONC8MSG@(
  1. ; 0) Result descriptor
  1. ; ^01: Number of errors
  1. ; ^02: Number of warnings
  1. ; ^03: Web-service version
  1. ; ^04: Metafile version
  1. ; set#,
  1. ; 0) Edit set descriptor
  1. ; ^01: Number of errors
  1. ; ^02: Number of warnings
  1. ; 1) Edit set name
  1. ; "E",
  1. ; edit#,
  1. ; 0) Edit descriptor
  1. ; ^01: Number of errors
  1. ; ^02: Number of warnings
  1. ; ^03: Edit index
  1. ; 1) Edit name
  1. ; "F",
  1. ; fld#,
  1. ; 0) Field descriptor
  1. ; ^01: Start position
  1. ; 1) Field name
  1. ; 2) Field value
  1. ;
  1. ; "M",
  1. ; msg#,
  1. ; 0) Message descriptor
  1. ; ^01: Code
  1. ; ^02: Type
  1. ; 1) Message text
  1. ;
  1. ; "ES",
  1. ; edit#) set#
  1. ;
  1. ; The ^TMP("ONCSED01R",$J) and ^TMP("ONCSED01M",$J) global nodes
  1. ; are used by this function.
  1. ;
  1. ; Return values:
  1. ;
  1. ; <0 Error Descriptor (see ^ONCSAPI for details)
  1. ; For example:
  1. ; "-6^Parameter 'ONC8REQ' has an invalid value: ''^
  1. ; RBQEXEC+3^ONCSED01"
  1. ;
  1. ; 0 Ok
  1. ;
  1. ; 1 EDITS Warnings
  1. ;
  1. ; 2 EDITS Errors
  1. ;
  1. RBQEXEC(ONCSAPI,ONC8REQ,ONC8MSG) ;
  1. N ONC8RDAT,RC,TMP,URL,X
  1. ;--- Validate parameters
  1. Q:$G(ONC8REQ)?." " $$ERROR^ONCSAPIE(-6,,"ONC8REQ",$G(ONC8REQ))
  1. S:$G(ONC8MSG)?." " ONC8MSG=$NA(^TMP("ONCSED01M",$J))
  1. ;--- Initialize variables
  1. S ONC8RDAT=$NA(^TMP("ONCSED01R",$J))
  1. K @ONC8RDAT,@ONC8MSG
  1. ;
  1. ;--- Finish preparation of the NAACCR record
  1. D END^ONCSNACR(.ONC8REQ)
  1. ;
  1. ;--- Complete the request
  1. D TRAILER^ONCSAPIR(.ONC8REQ)
  1. ;
  1. ;--- Get the server URL ;commented url to use HWSC
  1. S URL=$$GETCSURL^ONCSAPIU() Q:URL<0 URL
  1. ;
  1. S RC=0 D
  1. . ;--- Call the web service ; commented run batch request and use HWSC
  1. . D:$G(ONCSAPI("DEBUG"))
  1. . . D ZW^ONCSAPIU(ONC8REQ,"*** 'RUN BATCH' REQUEST ***")
  1. . ;S RC=$$REQUEST^ONCSAPIR(URL,ONC8RDAT,ONC8REQ) Q:RC<0
  1. . ; P16
  1. . S ONCEXEC="P" D T3^ONCWEB1
  1. . D:$G(ONCSAPI("DEBUG"))
  1. . . D ZW^ONCSAPIU(ONC8RDAT,"*** 'RUN BATCH' RESPONSE ***")
  1. . ;--- Parse the response
  1. . D PARSE^ONCWEBP1
  1. . ;S RC=$$PARSE^ONCSED02(.ONCSAPI,ONC8RDAT,ONC8MSG)
  1. ;
  1. ;--- Cleanup
  1. K ^TMP("ONCSED01R",$J)
  1. D:RC'<0
  1. . S TMP=$G(@ONC8MSG@(0))
  1. . S RC=$S($P(TMP,U,1)>0:2,$P(TMP,U,2)>0:1,1:0)
  1. Q RC
  1. ;
  1. ;***** STARTS PREPARATION OF THE 'RUN BATCH' EDITS REQUEST
  1. ;
  1. ; [.ONCSAPI] Reference to the API descriptor (see ^ONCSAPI)
  1. ;
  1. ; .ONC8REQ Reference to a local variable that stores the
  1. ; closed root of the buffer for the request.
  1. ;
  1. ; Sub-nodes of the variable are used internally
  1. ; (see ^ONCSNACR and ^ONCSAPIR for details).
  1. ;
  1. ; [CFGNAME] Name of the configuration that should be used by
  1. ; the server to validate the data. By default,
  1. ; the default configuration is used.
  1. ;
  1. ; Return values:
  1. ;
  1. ; <0 Error Descriptor (see ^ONCSAPI for details)
  1. ; For example:
  1. ; "-6^Parameter 'ONC8REQ' has an invalid value: ''^
  1. ; RBQPREP+3^ONCSED01"
  1. ;
  1. ; 0 Ok
  1. ;
  1. RBQPREP(ONCSAPI,ONC8REQ,CFGNAME) ;
  1. N ATTS
  1. D CLEAR^ONCSAPIE()
  1. ;--- Validate parameters
  1. Q:$G(ONC8REQ)?." " $$ERROR^ONCSAPIE(-6,,"ONC8REQ",$G(ONC8REQ))
  1. ;
  1. ;--- Standard request header
  1. S:'($G(CFGNAME)?." ") ATTS("edits-config")=CFGNAME
  1. D HEADER^ONCSAPIR(.ONC8REQ,"ED-RUN-BATCH",.ATTS)
  1. ;
  1. ;--- Start preparation of the NAACCR record
  1. D BEGIN^ONCSNACR(.ONC8REQ)
  1. ;---
  1. Q 0
  1. ;
  1. ;***** PRINTS 'EDITS' REPORT ON THE CURRENT DEVICE
  1. ;
  1. ; [.ONCSAPI] Reference to the API descriptor (see ^ONCSAPI)
  1. ;
  1. ; ONC8MSG Closed root of the list of parsed error messages
  1. ; (generated by the RBQEXEC^ONCSED0101)
  1. ;
  1. ; [FLAGS] Flags that control the output (can be combined):
  1. ; M Include messages
  1. ; T Include totals
  1. ;
  1. ; Return values:
  1. ;
  1. ; <0 Error Descriptor (see ^ONCSAPI for details)
  1. ; For example:
  1. ; "-6^Parameter 'ONC8REQ' has an invalid value: ''^
  1. ; RBQEXEC+3^ONCSED01"
  1. ;
  1. ; 0 Ok
  1. ;
  1. ; 1 Timeout
  1. ; 2 User canceled the output ('^' was entered)
  1. ;
  1. REPORT(ONCSAPI,ONC8MSG,FLAGS) ;
  1. N RC,TMP
  1. S TMP=$G(@ONC8MSG@(0))
  1. Q:($P(TMP,U,1)'>0)&($P(TMP,U,2)'>0) 0
  1. S FLAGS=$G(FLAGS)
  1. I $TR(FLAGS,"MT")'=FLAGS W:$E(IOST,1,2)="C-" @IOF
  1. ;--- EDITS messages
  1. I FLAGS["M" D Q:RC RC
  1. . S RC=$$MESSAGES^ONCSED03(.ONCSAPI,ONC8MSG,FLAGS)
  1. ;--- EDITS totals
  1. I FLAGS["T" D Q:RC RC
  1. . S RC=$$TOTALS^ONCSED03(.ONCSAPI,ONC8MSG,FLAGS)
  1. ;---
  1. Q 0
  1. ;
  1. XMLHDR ;XML header for Edits
  1. S ONCXMHR="EDIT" ;for EDIT testing
  1. S ONCSKEY="d27e1428f71e47239327d7e77e1439c6"
  1. I $D(ONCCSTP) S:ONCCSTP="U" ONCCSTP="Update" S:ONCCSTP="N" ONCCSTP="New"
  1. S ONCT=$$NOW^XLFDT(),ONCTZONE=$$TZ^XLFDT()
  1. ;S ONCT=$$HLDATE^HLFNC($$NOW^XLFDT()) ;USE this code instead
  1. S ONCTHR=$E(ONCT,9,10),ONCTMN=$E(ONCT,11,12),ONCTSN=$E(ONCT,13,14)
  1. S:ONCTSN="" ONCTSN="00"
  1. S:($L(ONCTSN)=1) ONCTSN="0"_ONCTSN
  1. S ONCTSN=ONCTSN_".000"_$E(ONCTZONE,1,3)_":"_$E(ONCTZONE,4,5)
  1. S ONCDTNW=""""_(1700+$E(ONCT,1,3))_"-"_$E(ONCT,4,5)_"-"_$E(ONCT,6,7)_"T"_ONCTHR_":"_ONCTMN_":"_ONCTSN_""""
  1. S ONCX21=1,ONCXML=6
  1. S ONCDIC="""http://naaccr.org/naaccrxml/naaccr-dictionary-230.xml"""
  1. S ONC11=" baseDictionaryUri="
  1. S ONC22=" recordType=",ONC33=" timeGenerated=",ONC44=" specificationVersion="
  1. ;For Edits and Collaborative Staging (CS)
  1. S:ONCXMHR="EDIT" ONCREQT="EditCheckRequest"
  1. S:ONCXMHR="CS" ONCREQT="CsCheckRequest"
  1. S ^TMP("ONC",$J,1)="<?xml version=""1.0"" encoding=""utf-8""?>"
  1. ;S ^TMP("ONC",$J,2)="<soap:Envelope xmlns:soap=""http://www.w3.org/2001/12/soap-envelope"""
  1. ;S ^TMP("ONC",$J,3)=" soap:encodingStyle=""http://www.w3.org/2001/12/soap-encoding"">"
  1. ;S ^TMP("ONC",$J,4)="<soap:Body>"
  1. ;S ^TMP("ONC",$J,5)="<"_ONCREQT_">"
  1. ;S ^TMP("ONC",$J,6)="<requestId>"_ONCREID_"</requestId>"
  1. ;S ^TMP("ONC",$J,7)="<caseId>"_ONCCSID_"</caseId>"
  1. ;S ^TMP("ONC",$J,8)="<caseType>"_ONCCSTP_"</caseType>"
  1. ;S ^TMP("ONC",$J,9)="<NaaccrData baseDictionaryUri=""http://naaccr.org/naaccrxml/naaccr-dictionary-230.xml"" recordType=""C"" timeGenerated="_ONCDTNW_" specificationVersion=""1.4"" xmlns=""http://naaccr.org/naaccrxml"""_">"
  1. S ^TMP("ONC",$J,2)="<"_ONCREQT_">"
  1. ;S ^TMP("ONC",$J,3)="<requestId>"_ONCREID_"</requestId>"
  1. S ^TMP("ONC",$J,3)="<requestId>"_ONCREID_"</requestId>" ;test failure
  1. S ^TMP("ONC",$J,4)="<caseId>"_ONCCSID_"</caseId>"
  1. S ^TMP("ONC",$J,5)="<caseType>"_ONCCSTP_"</caseType>"
  1. ;S ^TMP("ONC",$J,6)="<ocpApimSubscriptionKey>"_ONCSKEY_"</ocpApimSubscriptionKey>"
  1. S ^TMP("ONC",$J,6)="<NaaccrData baseDictionaryUri=""http://naaccr.org/naaccrxml/naaccr-dictionary-230.xml"" recordType=""C"" timeGenerated="_ONCDTNW_" specificationVersion=""1.4"" xmlns=""http://naaccr.org/naaccrxml"""_">"
  1. Q
  1. XMLEDIT ;Prepares EDIT xml data
  1. N ONCDE
  1. ;
  1. N ONCRTYP,ONCOLD,ONCPOS
  1. S ONCOLD="TEST",(ONCPOS,POS)="A",ONCRTYP="",ONCIE160(IEN)=IEN
  1. F S POS=$O(^ONCO(160.16,EXTRACT,"FIELD","D",POS)) Q:POS="" D
  1. .N NODE,ONCXDATA S NODE=0
  1. .I POS="P" S ONCRTYP="<Patient>"
  1. .I POS="T" S ONCRTYP="<Tumor>"
  1. .F S NODE=$O(^ONCO(160.16,EXTRACT,"FIELD","D",POS,NODE)) Q:NODE<1 D Q:OUT
  1. ..N STRING,DEFAULT,FILL,LEN,ONCXDATA
  1. ..Q:$G(^ONCO(160.16,EXTRACT,"FIELD",NODE,0))=""
  1. ..S ONCXDATA=$P(^ONCO(160.16,EXTRACT,"FIELD",NODE,0),U,5)
  1. ..Q:ONCXDATA=""
  1. ..I (POS'=ONCPOS),(ONCOLD'=ONCRTYP),(ONCRTYP'="") D
  1. ...S:POS="P" ^TMP("ONC",$J,ONCXML+1)=ONCRTYP,ONCXML=ONCXML+1
  1. ...S:POS="T" ^TMP("ONC",$J,ONCXML+1)=ONCRTYP,ONCXML=ONCXML+1
  1. ...S ONCOLD=ONCRTYP,ONCPOS=POS
  1. ..S LEN=$P(^ONCO(160.16,EXTRACT,"FIELD",NODE,0),U,2)
  1. ..S STRING=$TR(^ONCO(160.16,EXTRACT,"FIELD",NODE,1),"~","^")
  1. ..S DEFAULT=$P(^ONCO(160.16,EXTRACT,"FIELD",NODE,2),U,1)
  1. ..S FILL=$P(^ONCO(160.16,EXTRACT,"FIELD",NODE,3),U,1)
  1. ..;D DATA^ONCACD1(IEN,ACD160,STRING,DEFAULT,FILL,LEN,JUMP,NODE,POS)
  1. ..D DATA
  1. .S ONCXPRT=1
  1. S ^TMP("ONC",$J,ONCXML+1)="</Tumor>",ONCXML=ONCXML+1
  1. S ^TMP("ONC",$J,ONCXML+1)="</Patient>",ONCXML=ONCXML+1
  1. S ^TMP("ONC",$J,ONCXML+1)="</NaaccrData>",ONCXML=ONCXML+1
  1. S ^TMP("ONC",$J,ONCXML+1)="</EditCheckRequest>",ONCXML=ONCXML+1
  1. ;S ^TMP("ONC",$J,ONCXML+1)="</soap:Body>",ONCXML=ONCXML+1
  1. ;S ^TMP("ONC",$J,ONCXML+1)="</soap:Envelope>",ONCXML=ONCXML+1
  1. ;B K ^TMP("ONC",$J)
  1. ;F I=1:1:167 S ^TMP("ONC",$J,I)=^XMB(3.9,3108776,2,I,0)
  1. ;B
  1. Q
  1. DATA ;
  1. N ACDANS,EXIT S EXIT=0
  1. S:'$D(ONCPHI) ONCPHI=0 ;P2.2*4
  1. I $G(ONCX21)=1 D
  1. .;I $G(ONCPRNT)>20,(POS="N") Q
  1. .X STRING
  1. .;If value = "", extract DEFAULT value
  1. .I (ACDANS=""),(DEFAULT="BLANK") Q
  1. .N I,X S X=""
  1. .I DEFAULT=8 D
  1. ..F I=1:1:LEN S ACDANS=ACDANS_@DEFAULT
  1. .I @DEFAULT="09" S ACDANS=@DEFAULT
  1. .I (ACDANS["&")!(ACDANS["<")!(ACDANS[">") D STRIP^ONCACD1
  1. .D XFILL^ONCACD1
  1. .;S:POS="N" ONCTAB=" "
  1. .;S:POS="P" ONCTAB=" "
  1. .;S:POS="T" ONCTAB=" "
  1. .Q:ACDANS=""
  1. .S ^TMP("ONC",$J,ONCXML+1)="<Item naaccrId="""_ONCXDATA_""">"_ACDANS_"</Item>",ONCXML=ONCXML+1
  1. .;S ONCPRNT=ONCPRNT+1
  1. .Q
  1. Q