YTQREST0 ;SLC/KCM - RESTful API front controller v0 ; 1/25/2017
;;5.01;MENTAL HEALTH;**130,178,182,187,223,239,224**;Dec 30, 1994;Build 17
;
; .HTTPREQ: HTTP-formatted request and JSON body (if present)
; .HTTPRSP: HTTP-formatted response and JSON body (if present)
;
QSTAFF(HTTPRSP,HTTPREQ) ; questionnaire administration resources
;;POST /api/mha/assignment NEWASMT^YTQRQAD1
;;
D WINFIX(.HTTPREQ) ; Fix the malformed JSON from Windows MHA
D HANDLE^YTQRUTL("QSTAFF^YTQREST0",.HTTPREQ,.HTTPRSP)
Q
;
; -- for use when using embedded browser
;
;;GET /api/mha/patient/:dfn/identifiers PID^YTQRQAD
;;GET /api/mha/persons/:match PERSONS^YTQRQAD
;;GET /api/mha/users/:match USERS^YTQRQAD
;;GET /api/mha/instruments/active LSTALL^YTQRQAD
;;GET /api/mha/instruments/cprs LSTCPRS^YTQRQAD
;;GET /api/mha/instrument/:instrumentName GETSPEC^YTQRQAD
;;GET /api/mha/assignment/:assignmentId?1.N ASMTBYID^YTQRQAD1
;;GET /api/mha/assignment/:assignmentId?1.N/:division ASMTBYID^YTQRQAD1
;;DELETE /api/mha/assignment/:assignmentId DELASMT^YTQRQAD1
;;DELETE /api/mha/assignment/:assignmentId/:instrument DELTEST^YTQRQAD1
;;POST /api/mha/instrument/admin SAVEADM^YTQRQAD2
;;GET /api/mha/instrument/admin/:adminId?1.N GETADM^YTQRQAD2
;;GET /api/mha/instrument/report/:adminId?1.N REPORT^YTQRQAD3
;;GET /api/mha/instrument/note/:adminId?1.N GETNOTE^YTQRQAD3
;;POST /api/mha/instrument/note SETNOTE^YTQRQAD3
;;GET /api/mha/permission/cosign/:adminId/:userId ALWCSGN^YTQRQAD3
;;GET /api/mha/division/current/ TMPDIV^YTQRQAD
;;POST /api/wrapper/close WRCLOSE^YTQRQAD
;;
QENTRY(HTTPRSP,HTTPREQ) ; questionnaire entry for patient
;;GET /api/mha/patient/:dfn/identifiers PID^YTQRQAD
;;GET /api/mha/instrument/:instrumentName GETSPEC^YTQRQAD
;;GET /api/mha/assignment/:assignmentId?1.N ASMTBYID^YTQRQAD1
;;GET /api/mha/assignment/:assignmentId?36ANP ASMTBYID^YTQRQAD1
;;GET /api/mha/checks/:instrumentName GETCHKS^YTQRQAD2
;;GET /api/mha/instrument/admin/:adminId?1.N GETADM^YTQRQAD2
;;GET /api/mha/instrument/admin/:adminId?36ANP1"-".N GETADM^YTQRQAD2
;;POST /api/mha/instrument/admin SAVEADM^YTQRQAD2
;;GET /api/mha/assignment/cat/:assignmentId?1.N GCATINFO^YTQRCAT
;;GET /api/mha/assignment/cat/:assignmentId?36ANP GCATINFO^YTQRCAT
;;POST /api/mha/assignment/cat/:assignmentId?1.N PCATINFO^YTQRCAT
;;POST /api/mha/assignment/cat/:assignmentId?36ANP PCATINFO^YTQRCAT
;;GET /api/mha/cat/interview/:interviewId GETCATI^YTQRCAT
;;POST /api/mha/cat/interview/:interviewId SETCATI^YTQRCAT
;;DELETE /api/mha/assignment/:assignmentId/:instrument/:delfrmassign DELTEST^YTQRQAD1
;;GET /api/mha/cdb/timezone/ TZ^YTQRCDB2
;;POST /api/mha/cdb/instrument/admin SAVEADM^YTQRCDB
;;POST /api/mha/cdb/instrument/admin/scores SCORADM^YTQRCDB
;;POST /api/mha/cdb/instrument/note PENOTE^YTQRCDB3
;;
D HANDLE^YTQRUTL("QENTRY^YTQREST0",.HTTPREQ,.HTTPRSP)
Q
WINFIX(HTTPREQ) ; Fix the malformed JSON from Windows MHA
N I,BODY,SWAP
S BODY=0
S SWAP(""":,")=""":null,"
S SWAP(""":}")=""":null}"
S I=0 F S I=$O(HTTPREQ(I)) Q:'I D
. I BODY S HTTPREQ(I)=$$REPLACE^XLFSTR(HTTPREQ(I),.SWAP)
. I '$L(HTTPREQ(I)) S BODY=1
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HYTQREST0 3194 printed Nov 22, 2024@17:28:51 Page 2
YTQREST0 ;SLC/KCM - RESTful API front controller v0 ; 1/25/2017
+1 ;;5.01;MENTAL HEALTH;**130,178,182,187,223,239,224**;Dec 30, 1994;Build 17
+2 ;
+3 ; .HTTPREQ: HTTP-formatted request and JSON body (if present)
+4 ; .HTTPRSP: HTTP-formatted response and JSON body (if present)
+5 ;
QSTAFF(HTTPRSP,HTTPREQ) ; questionnaire administration resources
+1 ;;POST /api/mha/assignment NEWASMT^YTQRQAD1
+2 ;;
+3 ; Fix the malformed JSON from Windows MHA
DO WINFIX(.HTTPREQ)
+4 DO HANDLE^YTQRUTL("QSTAFF^YTQREST0",.HTTPREQ,.HTTPRSP)
+5 QUIT
+6 ;
+7 ; -- for use when using embedded browser
+8 ;
+9 ;;GET /api/mha/patient/:dfn/identifiers PID^YTQRQAD
+10 ;;GET /api/mha/persons/:match PERSONS^YTQRQAD
+11 ;;GET /api/mha/users/:match USERS^YTQRQAD
+12 ;;GET /api/mha/instruments/active LSTALL^YTQRQAD
+13 ;;GET /api/mha/instruments/cprs LSTCPRS^YTQRQAD
+14 ;;GET /api/mha/instrument/:instrumentName GETSPEC^YTQRQAD
+15 ;;GET /api/mha/assignment/:assignmentId?1.N ASMTBYID^YTQRQAD1
+16 ;;GET /api/mha/assignment/:assignmentId?1.N/:division ASMTBYID^YTQRQAD1
+17 ;;DELETE /api/mha/assignment/:assignmentId DELASMT^YTQRQAD1
+18 ;;DELETE /api/mha/assignment/:assignmentId/:instrument DELTEST^YTQRQAD1
+19 ;;POST /api/mha/instrument/admin SAVEADM^YTQRQAD2
+20 ;;GET /api/mha/instrument/admin/:adminId?1.N GETADM^YTQRQAD2
+21 ;;GET /api/mha/instrument/report/:adminId?1.N REPORT^YTQRQAD3
+22 ;;GET /api/mha/instrument/note/:adminId?1.N GETNOTE^YTQRQAD3
+23 ;;POST /api/mha/instrument/note SETNOTE^YTQRQAD3
+24 ;;GET /api/mha/permission/cosign/:adminId/:userId ALWCSGN^YTQRQAD3
+25 ;;GET /api/mha/division/current/ TMPDIV^YTQRQAD
+26 ;;POST /api/wrapper/close WRCLOSE^YTQRQAD
+27 ;;
QENTRY(HTTPRSP,HTTPREQ) ; questionnaire entry for patient
+1 ;;GET /api/mha/patient/:dfn/identifiers PID^YTQRQAD
+2 ;;GET /api/mha/instrument/:instrumentName GETSPEC^YTQRQAD
+3 ;;GET /api/mha/assignment/:assignmentId?1.N ASMTBYID^YTQRQAD1
+4 ;;GET /api/mha/assignment/:assignmentId?36ANP ASMTBYID^YTQRQAD1
+5 ;;GET /api/mha/checks/:instrumentName GETCHKS^YTQRQAD2
+6 ;;GET /api/mha/instrument/admin/:adminId?1.N GETADM^YTQRQAD2
+7 ;;GET /api/mha/instrument/admin/:adminId?36ANP1"-".N GETADM^YTQRQAD2
+8 ;;POST /api/mha/instrument/admin SAVEADM^YTQRQAD2
+9 ;;GET /api/mha/assignment/cat/:assignmentId?1.N GCATINFO^YTQRCAT
+10 ;;GET /api/mha/assignment/cat/:assignmentId?36ANP GCATINFO^YTQRCAT
+11 ;;POST /api/mha/assignment/cat/:assignmentId?1.N PCATINFO^YTQRCAT
+12 ;;POST /api/mha/assignment/cat/:assignmentId?36ANP PCATINFO^YTQRCAT
+13 ;;GET /api/mha/cat/interview/:interviewId GETCATI^YTQRCAT
+14 ;;POST /api/mha/cat/interview/:interviewId SETCATI^YTQRCAT
+15 ;;DELETE /api/mha/assignment/:assignmentId/:instrument/:delfrmassign DELTEST^YTQRQAD1
+16 ;;GET /api/mha/cdb/timezone/ TZ^YTQRCDB2
+17 ;;POST /api/mha/cdb/instrument/admin SAVEADM^YTQRCDB
+18 ;;POST /api/mha/cdb/instrument/admin/scores SCORADM^YTQRCDB
+19 ;;POST /api/mha/cdb/instrument/note PENOTE^YTQRCDB3
+20 ;;
+21 DO HANDLE^YTQRUTL("QENTRY^YTQREST0",.HTTPREQ,.HTTPRSP)
+22 QUIT
WINFIX(HTTPREQ) ; Fix the malformed JSON from Windows MHA
+1 NEW I,BODY,SWAP
+2 SET BODY=0
+3 SET SWAP(""":,")=""":null,"
+4 SET SWAP(""":}")=""":null}"
+5 SET I=0
FOR
SET I=$ORDER(HTTPREQ(I))
if 'I
QUIT
Begin DoDot:1
+6 IF BODY
SET HTTPREQ(I)=$$REPLACE^XLFSTR(HTTPREQ(I),.SWAP)
+7 IF '$LENGTH(HTTPREQ(I))
SET BODY=1
End DoDot:1
+8 QUIT