source: WorldVistAEHR/trunk/r/ONCOLOGY-ONC/ONCSAPIS.m@ 619

Last change on this file since 619 was 613, checked in by George Lilly, 15 years ago

initial load of WorldVistAEHR

File size: 2.5 KB
RevLine 
[613]1ONCSAPIS ;Hines OIFO/SG - COLLABORATIVE STAGING (SCHEMAS) ; 3/25/04 3:24pm
2 ;;2.11;ONCOLOGY;**40**;Mar 07, 1995
3 ;
4 Q
5 ;
6 ;***** RETURNS SCHEMA NUMBER AND NAME
7 ;
8 ; [.ONCSAPI] Reference to the API descriptor (see ^ONCSAPI)
9 ;
10 ; SITE Primary site
11 ; HIST Histology
12 ;
13 ; The ^TMP("ONCSAPIS",$J) global node is used by this function.
14 ;
15 ; Return Values:
16 ; >0 SchemaNumber^SchemaName
17 ; <0 Error code
18 ;
19SCHEMA(ONCSAPI,SITE,HIST) ;
20 N DST,NODE,ONCREQ,ONCRSP,ONCXML,RC,SCHEMA,SCHNAME,TMP,URL,XHIST,XSITE
21 D CLEAR^ONCSAPIE()
22 ;--- Initialize constants and variables
23 S NODE=$NA(^XTMP("ONCSAPI","SCHEMAS"))
24 S XSITE=$S(SITE'="":SITE,1:" ")
25 S XHIST=$S(HIST'="":HIST,1:" ")
26 ;--- Check if the schema is available in the local cache
27 S SCHEMA=+$G(@NODE@("SH",XSITE,XHIST))
28 I SCHEMA>0 D Q:SCHNAME'="" SCHEMA_U_SCHNAME
29 . S SCHNAME=$P($G(@NODE@(SCHEMA)),U)
30 S ONCRSP=$NA(^TMP("ONCSAPIS",$J)) K @ONCRSP
31 ;--- Get the server URL
32 S URL=$$GETCSURL^ONCSAPIU()
33 ;
34 S RC=0 D
35 . ;--- Prepare the request data
36 . S DST="ONCREQ"
37 . D HEADER^ONCSAPIR(.DST,"CS-GET-SCHEMA")
38 . D PUT^ONCSAPIR(.DST,"SITE",SITE)
39 . D PUT^ONCSAPIR(.DST,"HIST",HIST)
40 . D TRAILER^ONCSAPIR(.DST)
41 . ;--- Request the schema number
42 . D:$G(ONCSAPI("DEBUG"))
43 . . D ZW^ONCSAPIU("ONCREQ","*** 'SCHEMA' REQUEST ***",1)
44 . S RC=$$REQUEST^ONCSAPIR(URL,ONCRSP,"ONCREQ") Q:RC<0
45 . D:$G(ONCSAPI("DEBUG"))
46 . . D ZW^ONCSAPIU(ONCRSP,"*** 'SCHEMA' RESPONSE ***",1)
47 . K DST,ONCREQ
48 . ;--- Parse the response
49 . D SETCBK(.CBK),EN^MXMLPRSE(ONCRSP,.CBK,"W")
50 . ;--- Check for parsing and web service errors
51 . S RC=$$CHKERR^ONCSAPIR(.ONCXML) Q:RC<0
52 . ;--- Check the schema number and name
53 . S SCHEMA=+$G(ONCXML("SCHEMA"))
54 . S SCHNAME=$G(ONCXML("SCHEMA-NAME"))
55 . I (SCHEMA'>0)!(SCHNAME="") S RC=$$ERROR^ONCSAPIE(-14) Q
56 . ;--- Update the local cache
57 . S @NODE@(SCHEMA)=SCHNAME
58 . S @NODE@("SH",XSITE,XHIST)=SCHEMA
59 . S @NODE@("N",SCHNAME)=SCHEMA
60 ;
61 ;--- Cleanup
62 K @ONCRSP
63 Q $S(RC<0:RC,1:SCHEMA_U_SCHNAME)
64 ;
65 ;***** SETS THE EVENT INTERFACE ENTRY POINTS
66 ;
67 ; .CBK Reference to the destination list
68 ;
69SETCBK(CBK) ;
70 ;;CHARACTERS^TEXT^ONCSAPIS
71 ;
72 D SETCBK^ONCSAPIX(.CBK,"SETCBK^ONCSAPIS")
73 Q
74 ;
75 ;***** TEXT CALLBACK FOR THE SAX PARSER
76 ;
77 ; TXT Line of unmarked text
78 ;
79TEXT(TXT) ;
80 N L,L2E
81 S L=$L(ONCXML("PATH"),","),L2E=$P(ONCXML("PATH"),",",L-1,L)
82 ;--- Schema number and name
83 I L2E="CS-RESPONSE,SCHEMA" S ONCXML("SCHEMA")=TXT Q
84 I L2E="CS-RESPONSE,SCHEMA-NAME" S ONCXML("SCHEMA-NAME")=TXT Q
85 ;--- Default processing
86 D TEXT^ONCSAPIX(TXT)
87 Q
Note: See TracBrowser for help on using the repository browser.