Difference between revisions of "TIU Package API"

From VistApedia
Jump to: navigation, search
(TIU API)
 
(39 intermediate revisions by 6 users not shown)
Line 1: Line 1:
 +
Back to [[Programming VistA Issues]]
 +
 
=== TIU API ===
 
=== TIU API ===
  
The [[CPRS Text Integration Utility (TIU)|TIU package]] deals with medical records, i.e. progress notes, discharge summaries etc. etc.
+
The [[CPRS Text Integration Utility (TIU)|TIU package]] deals with medical [[Record~|Record]]s, i.e. [[PROGRESS NOTE~|progress notes]], [[DISCHARGE SUMMARY~|discharge summaries]] etc. etc.
  
No documentation of an [[API]] was created with the TIU [[package]].  The purpose of this page will be to document some entry points, for those needing an API.  This page will be used as a workspace, as the interdependencies etc. are explored.
+
No documentation of an [[API~|API]] was created with the TIU [[package]].  The purpose of this page will be to document some entry points, for those needing an API.  This page will be used as a work in progress, as the interdependencies etc. are explored.
  
=== File: TIUEPRNT.m ===
+
[[Entire TIU Source Code|List of all M routines in TIU]]
 +
 
 +
=== TIU Document Array ===
 +
Many of the TIU functions pass an array that holds information about the current document.  Here is the info that I have been able to determine:
 +
 
 +
TIU("VSTR") = LOC;VDT;VTYP
 +
TIU("VISIT") = Visit File IFN^date?
 +
TIU("LOC")
 +
TIU("VLOC")
 +
TIU("STOP") = mark to defer workload
 +
TIU("TYPE")=1^title DA^title Name  i.e.:  1^128^OFFICE VISIT^OFFICE VISIT
 +
TIU("SVC")=service  e.g. "FAMILY PRACTICE"
 +
TIU("EDT")=TIUEDT^DateStr  = event begin time: FMDate^DateStr
 +
TIU("LDT")=TIULDT^DateStr  = event end time: FMDate^DateStr
 +
TIU("VSTR")=LOC;VDT;VTYP  e.g. "x;x;OFFICE VISIT" 
 +
TIU("VISIT")=Visit File IFN
 +
TIU("LOC")=TIULOC
 +
TIU("VLOC")=TIULOC
 +
TIU("STOP")=0  ;"0=FALSE, don't worry about [[stop code~|Stop Code]]s.
 +
 
 +
=== Print a Document ===
 
<mentry>PRINT^TIUEPRNT</mentry>(RecNum)
 
<mentry>PRINT^TIUEPRNT</mentry>(RecNum)
  
Purpose: prompts user, "Do you want to print note?"  Then asks if chart or work copy, and destination device.   
+
Purpose: [[prompt~|Prompt]]s user, "Do you want to print note?"  Then asks if chart or work copy, and destination device.   
 +
 
 +
    RecNum: is [[record~|Record]] number of note to print, aka DA, in the {{File|TIU DOCUMENT}}.
 +
 
 +
=== Print Documents(s) ===
 +
<mentry>PRINT^TIUPRPN1</mentry>(WorkType,Paging)
  
RecNum: is record number of note to print, aka DA, in the {{File|TIU DOCUMENT}}.
+
Purpose: Print document array
  
== File: TIURS.m ===
+
    Input:
 +
      ^TMP("TIUPR",$J) is array of [[record~|Record]]s to be printed
 +
          Format:^TMP("TIUPR",$J,S,Order,TIUDA)=TIUPFNBR (e.g. "Vice SF 509")
 +
                    S format:  "SSN;DNF"  or "TIUGRP$HeaderText;DFN
 +
                        SSN=Patient's Social security number
 +
                        DFN=Patient's [[record~|Record]] number in file #2
 +
                        TIUGRP=??
 +
                        HeaderText=String to put into header (default='Progress Notes')
 +
                    Order: a sorting number. Date of note can be used for this
 +
                    TIUDA=[[record~|Record]] number in file 8925
 +
                e.g. SET ^TMP("TIUPR",$J,SSN_";"_DFN,DATE,DA)="Vice SF 509"
 +
      WorkType:  1=Chart Copy;  0=Work Copy
 +
      Paging:    1=Contiguous; 0=Fresh Page for each note
 +
 
 +
Called by:
 +
  <mentry>ENTRY^TIUPRPN</mentry>(TIUFLAG,TIUSPG)-- Print SF 509 Progress Notes
 +
  <mentry>PRINT^TIUPRPN5</mentry>(1,TIUSPG)    -- Sort PNs for printing by Location
 +
  <mentry>PRINT^TIUPRPN7</mentry>(1,1)          -- Progress Notes Output Batch Print
 +
 
 +
Notes:
 +
  It appears that the "contigious" notes have a header at the beginning,
 +
  but then no further header/footer divisions on each subsequent page.
 +
  ...NO.  This is only true when output device is a console.  If output
 +
  is a printer, then each page has headers/footers as expected.
 +
 
 +
=== Sign a Document ===
 
<mentry>EDSIG^TIURS</mentry>(TIUDA,TIUADD,TIUPASK)
 
<mentry>EDSIG^TIURS</mentry>(TIUDA,TIUADD,TIUPASK)
  
 
Purpose: Asks user for electronic signature code.  If correct, it signs note
 
Purpose: Asks user for electronic signature code.  If correct, it signs note
  
Input: TIUDA -- the is the IEN, or record number, from file 8925, of the document to sign.
+
Input:  
 +
 
 +
      TIUDA -- the is the IEN, or [[record number~|Record]], from file 8925, of the document to sign.
 
       TIUADD -- This appears to be an OUT parameter, and is set to 1
 
       TIUADD -- This appears to be an OUT parameter, and is set to 1
 
       TIUPASK -- I believe if value is not 0, then user is asked if they want to print note.
 
       TIUPASK -- I believe if value is not 0, then user is asked if they want to print note.
 +
 +
 +
=== Silently Sign a Document ===
 +
<mentry>ES^TIURS</mentry>(TIUDA,TIUES,TIUI)
 +
 +
Purpose: Asks user for electronic signature code.  If correct, it signs note
 +
 +
Input:
 +
 +
    TIUDA -- the is the IEN, or [[record~|Record]] number, from file 8925, of the document to sign.
 +
    TIUES -- a string like this: "1^Author Name^Signature Title"
 +
    TIUI -- Not used, optional (??)
 +
 +
Example of use:  (Thanks to author Kirk Fox)
 +
    ;This will autosign a note.
 +
    ;DUZ=THE SIGNER
 +
    ;R=IEN OF NOTE IN FILE 8925
 +
    S TIUES=1_U_$P($G(^VA(200,+DUZ,20)),U,2,3)
 +
    D ES^TIURS(R,TIUES) W "ES "_R
 +
    K TIUES
 +
    Q
 +
 +
=== Create a New Document ===
 +
<mentry>MAIN^TIUEDIT</mentry>(TIUCLASS,SUCCESS,DFN,TIUTITLE,EVNTFLAG,NOSAVE,TIUNDA,TIUSNGL,TIUCHNG) 
 +
 +
    Create new document(s)
 +
      May branch off to edit existing docmt instead of creating new one.
 +
      Call with: [TIUCLASS] --> pointer to file (8925) corresponding to
 +
                                the class (e.g., Progress Notes=3)
 +
                                from which to select a title
 +
        [by ref] [SUCCESS] --> Boolean flag returned as IFN when a
 +
                                [[record~|Record]] is created, or 0 when [[record~|Record]]
 +
                                creation fails
 +
                      [DFN] --> IEN in patient file (#2)
 +
                [TIUTITLE] --> Pointer or NAME or PTR^NAME of the
 +
                                TITLE from file 8925.1 to be used as
 +
                                the default.
 +
                [EVNTFLAG] --> Boolean flag for visit [[prompt~|Prompt]] (0 to
 +
                                [[prompt~|Prompt]], 1 to force event type visit)
 +
                  [NOSAVE] --> Boolean flag to suppress saving the data
 +
                                (e.g., when testing new Boilerplates
 +
                                using DDEF [[action~|Action]] TRY, etc.).
 +
          [by ref] [TIUNDA] --> array of form: TIUNDA(IFN)="".
 +
                                Used in SHOW NOTES ACROSS PATIENTS.
 +
                                See TIURC, which sets TIUONCE.
 +
                                Also used in TIUEDIM, for mult pts.
 +
                  [TIUSNGL] --> Boolean flag to create only ONE note
 +
                                regardless of multiple pt preference.
 +
        [by ref] [TIUCHNG] --> If received, passes back TIUCHNG array,
 +
                                which collects info across [[record~|Record]]s about
 +
                                [[action~|Action]]s taken. Used in feedback
 +
                                msgs to user.
 +
      Other variables:
 +
      sets [TIUTYP] --> array with form similar to that of XQORNOD:
 +
                                TIUTYP = title IFN
 +
                                TIUTYP(1) = 1^title IFN^title name,
 +
                                where 1 for us is just a positive #
 +
      sets  [TIUBY] --> used in some input templates to BYpass fields.
 +
      Called by:
 +
        Outpt Pharmacy, Consults, ...

Latest revision as of 03:30, 18 May 2015

Back to Programming VistA Issues

TIU API

The TIU package deals with medical Records, i.e. progress notes, discharge summaries etc. etc.

No documentation of an API was created with the TIU package. The purpose of this page will be to document some entry points, for those needing an API. This page will be used as a work in progress, as the interdependencies etc. are explored.

List of all M routines in TIU

TIU Document Array

Many of the TIU functions pass an array that holds information about the current document. Here is the info that I have been able to determine:

TIU("VSTR") = LOC;VDT;VTYP
TIU("VISIT") = Visit File IFN^date?
TIU("LOC")
TIU("VLOC")
TIU("STOP") = mark to defer workload
TIU("TYPE")=1^title DA^title Name  i.e.:  1^128^OFFICE VISIT^OFFICE VISIT
TIU("SVC")=service  e.g. "FAMILY PRACTICE"
TIU("EDT")=TIUEDT^DateStr  = event begin time: FMDate^DateStr
TIU("LDT")=TIULDT^DateStr  = event end time: FMDate^DateStr
TIU("VSTR")=LOC;VDT;VTYP  e.g. "x;x;OFFICE VISIT"   	
TIU("VISIT")=Visit File IFN
TIU("LOC")=TIULOC
TIU("VLOC")=TIULOC
TIU("STOP")=0  ;"0=FALSE, don't worry about Stop Codes.

Print a Document

<mentry>PRINT^TIUEPRNT</mentry>(RecNum)

Purpose: Prompts user, "Do you want to print note?" Then asks if chart or work copy, and destination device.

    RecNum: is Record number of note to print, aka DA, in the VA FileMan TIU DOCUMENT File.

Print Documents(s)

<mentry>PRINT^TIUPRPN1</mentry>(WorkType,Paging)

Purpose: Print document array

    Input:
      ^TMP("TIUPR",$J) is array of Records to be printed
         Format:^TMP("TIUPR",$J,S,Order,TIUDA)=TIUPFNBR (e.g. "Vice SF 509")
                   S format:  "SSN;DNF"   or "TIUGRP$HeaderText;DFN
                       SSN=Patient's Social security number
                       DFN=Patient's Record number in file #2
                       TIUGRP=??
                       HeaderText=String to put into header (default='Progress Notes')
                   Order: a sorting number. Date of note can be used for this
                   TIUDA=Record number in file 8925
               e.g. SET ^TMP("TIUPR",$J,SSN_";"_DFN,DATE,DA)="Vice SF 509"
      WorkType:   1=Chart Copy;  0=Work Copy 
      Paging:     1=Contiguous; 0=Fresh Page for each note

Called by:

 <mentry>ENTRY^TIUPRPN</mentry>(TIUFLAG,TIUSPG)-- Print SF 509 Progress Notes
 <mentry>PRINT^TIUPRPN5</mentry>(1,TIUSPG)     -- Sort PNs for printing by Location
 <mentry>PRINT^TIUPRPN7</mentry>(1,1)          -- Progress Notes Output Batch Print

Notes:

 It appears that the "contigious" notes have a header at the beginning,
 but then no further header/footer divisions on each subsequent page.
 ...NO.  This is only true when output device is a console.  If output
 is a printer, then each page has headers/footers as expected.

Sign a Document

<mentry>EDSIG^TIURS</mentry>(TIUDA,TIUADD,TIUPASK)

Purpose: Asks user for electronic signature code. If correct, it signs note

Input:

      TIUDA -- the is the IEN, or Record, from file 8925, of the document to sign.
      TIUADD -- This appears to be an OUT parameter, and is set to 1
      TIUPASK -- I believe if value is not 0, then user is asked if they want to print note.


Silently Sign a Document

<mentry>ES^TIURS</mentry>(TIUDA,TIUES,TIUI)

Purpose: Asks user for electronic signature code. If correct, it signs note

Input:

    TIUDA -- the is the IEN, or Record number, from file 8925, of the document to sign.
    TIUES -- a string like this: "1^Author Name^Signature Title"
    TIUI -- Not used, optional (??)

Example of use: (Thanks to author Kirk Fox)

    ;This will autosign a note.
    ;DUZ=THE SIGNER
    ;R=IEN OF NOTE IN FILE 8925
    S TIUES=1_U_$P($G(^VA(200,+DUZ,20)),U,2,3)
    D ES^TIURS(R,TIUES) W "ES "_R
    K TIUES
    Q

Create a New Document

<mentry>MAIN^TIUEDIT</mentry>(TIUCLASS,SUCCESS,DFN,TIUTITLE,EVNTFLAG,NOSAVE,TIUNDA,TIUSNGL,TIUCHNG)

    Create new document(s)
     May branch off to edit existing docmt instead of creating new one.
     Call with: [TIUCLASS] --> pointer to file (8925) corresponding to
                               the class (e.g., Progress Notes=3)
                               from which to select a title
        [by ref] [SUCCESS] --> Boolean flag returned as IFN when a
                               Record is created, or 0 when Record
                               creation fails
                     [DFN] --> IEN in patient file (#2)
                [TIUTITLE] --> Pointer or NAME or PTR^NAME of the
                               TITLE from file 8925.1 to be used as
                               the default.
                [EVNTFLAG] --> Boolean flag for visit Prompt (0 to
                               Prompt, 1 to force event type visit)
                  [NOSAVE] --> Boolean flag to suppress saving the data
                               (e.g., when testing new Boilerplates
                               using DDEF Action TRY, etc.).
         [by ref] [TIUNDA] --> array of form: TIUNDA(IFN)="".
                               Used in SHOW NOTES ACROSS PATIENTS.
                               See TIURC, which sets TIUONCE.
                               Also used in TIUEDIM, for mult pts.
                 [TIUSNGL] --> Boolean flag to create only ONE note
                               regardless of multiple pt preference.
        [by ref] [TIUCHNG] --> If received, passes back TIUCHNG array,
                               which collects info across Records about
                               Actions taken. Used in feedback
                               msgs to user.
     Other variables:
     sets [TIUTYP] --> array with form similar to that of XQORNOD:
                               TIUTYP = title IFN
                               TIUTYP(1) = 1^title IFN^title name,
                               where 1 for us is just a positive #
     sets  [TIUBY] --> used in some input templates to BYpass fields.
     Called by:
       Outpt Pharmacy, Consults, ...