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

TIUFWRAP2.m

Go to the documentation of this file.
  1. TIUFWRAP2 ;SPFO/AJB - Clean File #8927 ;04/06/22 12:50
  1. ;;1.0;TEXT INTEGRATION UTILITIES;**338,254**;Jun 20, 1997;Build 9
  1. ;
  1. Q
  1. ;
  1. FMR(DIR,PRM,DEF,HLP,SCR) ; fileman reader
  1. N DILN,DILOCKTM,DISYS
  1. N DIROUT,DIRUT,DTOUT,DUOUT,X,Y
  1. S DIR(0)=DIR S:$G(PRM)'="" DIR("A")=PRM S:$G(DEF)'="" DIR("B")=DEF S:$G(SCR)'="" DIR("S")=SCR
  1. I $G(HLP)'="" S DIR("?")=HLP
  1. I $D(HLP) M DIR=HLP
  1. W $G(IOCUON) D ^DIR W $G(IOCUOFF)
  1. Q $S($D(DIROUT):U,$D(DIRUT):U,$D(DTOUT):U,$D(DUOUT):U,1:Y)
  1. ;
  1. PRINT(LOC) ; print output
  1. Q:$G(LOC)=""
  1. N FIRST,ROOT S END="",FIRST=1,ROOT=$P(LOC,")"),LOC=$Q(@LOC)
  1. Q:LOC'[ROOT
  1. D:$E(IOST,1,2)="C-" CLS
  1. F D Q:(LOC="")!(END=U)
  1. . W:'+FIRST ! S FIRST=0
  1. . D BRK:$Y+4>IOSL Q:END=U W @LOC S LOC=$Q(@LOC) S:'(LOC[ROOT) LOC=""
  1. Q:END=U
  1. I $E(IOST,1,2)="C-" S END=U D FMR("EA","Press <Enter> to continue ")
  1. Q
  1. BRK ;
  1. I $E(IOST,1,2)="C-" S END=$$FMR("EA","Press <Enter> to continue or '^' to exit ")
  1. Q:END=U
  1. CLS ;
  1. W:$E(IOST,1,2)="C-" @IOF
  1. Q
  1. ;
  1. LOD(ANS) ; level of detail
  1. N DIR,HELP,PROMPT,X
  1. W @IOF,IOCUON,IOUON_$$CJ^XLFSTR("UPDATE TYPE [^TIU(8927,]",IOM)_IOUOFF,!
  1. S DIR="SA^1:BASIC;2:INTERMEDIATE;3:ADVANCED;Q:QUIT"
  1. N TMP S TMP="LODHELP^TIUFWRAP2"
  1. F X=1:1 S HELP=$P($T(LODHELP+X),";;",2) Q:HELP="EOM" D
  1. . S HELP("?",X)=HELP
  1. . W !,HELP
  1. S HELP("?")=" ",PROMPT="What type of UPDATE would you like? "
  1. W ! S ANS=$$FMR(DIR,PROMPT,"BASIC",.HELP)
  1. Q ANS
  1. ;
  1. LODHELP ;
  1. ;;Basic Attempt to fix broken fields/objects in boilerplate text.
  1. ;;
  1. ;; Delete entries with no boilerplate text, items, or linked
  1. ;; entries.
  1. ;;
  1. ;; Boilerplate text updates: Remove trailing spaces
  1. ;; Remove control characters
  1. ;;
  1. ;;Intermediate Basic + wrap lines >80 characters*.
  1. ;;
  1. ;;Advanced Basic + merge sequential lines of text**.
  1. ;;
  1. ;;* Please select HELP (** No, really!) on the main menu for more information.
  1. ;;EOM
  1. Q
  1. ;
  1. HELP ;
  1. N CNT,LABEL,LINE,OUTPUT S CNT=1,OUTPUT(CNT)=""
  1. F LINE=1:1 S LABEL=$P($T(CONTENTS+LINE),";;",2) Q:LABEL="EOM" D
  1. . S CNT=CNT+1,OUTPUT(CNT)=IOUON_$P(LABEL,U,2)_IOUOFF
  1. . D DATA(.CNT,"PART"_$P(LABEL,U))
  1. D BROWSE^DDBR("OUTPUT","NR","Help & Detailed Information")
  1. Q
  1. ;
  1. CONTENTS ;
  1. ;;01^Introduction & Critical Information
  1. ;;02^Backing Up/Restoring File #8927
  1. ;;03^Updating File #8927
  1. ;;04^Viewing Entries
  1. ;;05^Print/Email Entries
  1. ;;EOM
  1. ;
  1. DATA(CNT,OPT) ;
  1. N DATA,I F I=1:1 S DATA=$P($T(@OPT+I),";;",2) Q:DATA="EOM" D
  1. . S CNT=CNT+1,OUTPUT(CNT)=DATA
  1. Q
  1. ;
  1. DISPLAY(OPT) ; displays text from the parameter
  1. N DATA,I
  1. W:$D(IOF) @IOF
  1. F I=1:1 S DATA=$P($T(@OPT+I),";;",2) Q:DATA="EOM" D
  1. . W:OPT="INFO" @DATA,!
  1. Q
  1. ;
  1. INFO ;
  1. ;;IOUON_$$CJ^XLFSTR("TIU TEMPLATE (File #8927) Analysis & Cleanup Tool",IOM)_IOUOFF
  1. ;;""
  1. ;;"Critical Information: A backup copy of the TIU TEMPLATE file has been created"
  1. ;;" for you and can be restored from the menu below."
  1. ;;""
  1. ;;" This copy will remain on the system for 30 days."
  1. ;;""
  1. ;;" Select H(elp) for more information."
  1. ;;""
  1. ;;"Analyze File #8927 via the VIEW, PRINT, or EMAIL options."
  1. ;;EOM
  1. ;
  1. PART01 ;
  1. ;;
  1. ;; [Press <PF1>+Q or <CNTRL>+E to exit this browser.]
  1. ;;
  1. ;; Tip: If your keyboard doesn't have a separate 10-key keyboard (like a laptop),
  1. ;; your emulator should have a "Virtual Keyboard" so that you can access
  1. ;; the PF1 (and more) keys via the "Show or hide terminal keyboard." button.
  1. ;;
  1. ;; Please read this information before using the utility.
  1. ;;
  1. ;; This utility will attempt to fix most common issues with the TIU TEMPLATE
  1. ;; file [#8927].
  1. ;;
  1. ;; The TIU TEMPLATE file is automatically saved to the ^XTMP global at first
  1. ;; use.
  1. ;;
  1. ;; This data will automatically be removed from the system 30 days after it
  1. ;; is last used.
  1. ;;
  1. ;; Accessing the new TIU option, TIU ANALYZE/UPDATE FILE 8927 (Analyze/Update
  1. ;; File #8927) will update the purge date to T+30 to prevent the system from
  1. ;; removing the data.
  1. ;;
  1. ;;EOM
  1. ;;01234567890123456789012345678901234567890123456789012345678901234567890123456789
  1. ;
  1. PART02 ;
  1. ;;
  1. ;; The TIU TEMPLATE file will automatically be saved in the ^XTMP global.
  1. ;;
  1. ;; This will be the original, unaltered copy of the file.
  1. ;;
  1. ;; Selecting BACKUP from the main menu will automatically reset the purge date of
  1. ;; this data to T+30. This also happens automatically when you enter the utility.
  1. ;;
  1. ;; If the utility is not used for 30 days, the system will automatically remove
  1. ;; the saved data!
  1. ;;
  1. ;; RESTORE will restore File #8927 to its original state from the saved ^XTMP
  1. ;; data.
  1. ;;
  1. ;; You will be asked to confirm this action.
  1. ;;
  1. ;;EOM
  1. ;
  1. PART03 ;
  1. ;;
  1. ;; The UPDATE action has 3 levels to choose from for cleaning and fixing
  1. ;; entries in File #8927.
  1. ;;
  1. ;; Option 1) Basic Cleanup
  1. ;;
  1. ;; The Basic cleanup will NOT wrap any lines and may be used to safely
  1. ;; attempt to fix entries with broken fields and objects.
  1. ;;
  1. ;; The Basic cleanup will: Delete TEMPLATES that have no linked ITEMS, no
  1. ;; Boilerplate Text, or linked entries.
  1. ;;
  1. ;; Clean TEMPLATES by removing trailing spaces and
  1. ;; control characters embedded in boilerplate text.
  1. ;;
  1. ;; Attempt to fix the most common issue with broken
  1. ;; fields and objects: last field/object missing the
  1. ;; closing bracket.
  1. ;;
  1. ;; Option 2) Intermediate Cleanup
  1. ;;
  1. ;; The Intermediate cleanup will do all the above and WILL wrap lines that are
  1. ;; >80 characters. This can lead to incorrectly formatted text paragraphs in
  1. ;; templates that have long lines. This wrap is the default wrap seen when
  1. ;; creating a note with a TEMPLATE with long lines that display properly in the
  1. ;; CPRS TEMPLATE EDITOR with "Allow long lines" turned on.
  1. ;;
  1. ;; This is how CPRS wraps text >80 characters from TEMPLATES with long lines.
  1. ;;
  1. ;; Example (the 3rd line is >80 characters):
  1. ;;
  1. ;; Present pharmacotherapy assessed for appropriateness, dosing, efficacy
  1. ;; and safety, adverse effects, pharmacologic duplication, unnecessary meds,
  1. ;; omissions, drug interactions, indications, allergies, need for dose adjustment
  1. ;; based on organ
  1. ;; function, drug administration problems, etc.
  1. ;;
  1. ;; Option 3) Advanced Cleanup
  1. ;;
  1. ;; The Advanced cleanup will perform the Basic cleanup and WILL wrap lines that
  1. ;; are >80 characters. The primary difference is that it will attempt to fix
  1. ;; the common issue above with improperly formatted paragraphs of text.
  1. ;;
  1. ;; The Advanced cleanup will merge sequential lines of text and then wrap the
  1. ;; lines.
  1. ;;
  1. ;; Example:
  1. ;;
  1. ;; Present pharmacotherapy assessed for appropriateness, dosing, efficacy
  1. ;; and safety, adverse effects, pharmacologic duplication, unnecessary meds,
  1. ;; omissions, drug interactions, indications, allergies, need for dose adjustment
  1. ;; based on organ function, drug administration problems, etc.
  1. ;;
  1. ;; Exceptions to merging lines:
  1. ;;
  1. ;; - Lines of text less than 80 characters.
  1. ;; - Lines of text that end with an OBJECT or TEMPLATE FIELD.
  1. ;; - Lines of text that contain TEMPLATE FIELDS that resolve to less than
  1. ;; 80 characters.
  1. ;; - Lines of text where the next line contains one or more OBJECTS or
  1. ;; TEMPLATE FIELDS.
  1. ;;
  1. ;; ** WARNING ** The Intermediate and Advanced cleanup options may ruin the
  1. ;; formatting of TEMPLATES that have long lines and have special formatting
  1. ;; following the long lines.
  1. ;;
  1. ;; This is why a backup of the TIU TEMPLATE file MUST be made before running
  1. ;; the UPDATE.
  1. ;;
  1. ;; Press <PF1>+Q or <CNTRL>+E to exit this browser.
  1. ;;
  1. ;;EOM
  1. ;
  1. PART04 ;
  1. ;;
  1. ;; VIEW will allow the user to browse the following information:
  1. ;;
  1. ;; - Entries with Broken Fields/Objects.
  1. ;; - Entries with lines >80 characters.
  1. ;; - Entries that have no text, items or linked.
  1. ;; - Entries Missing Fields from File #8927.1
  1. ;; - Entries Missing Objects from File #8925.1
  1. ;;
  1. ;; In the browser, Press <PF1>S to select the CURRENT LIST to view.
  1. ;;
  1. ;; You MUST use <PF1> S to switch between the available lists.
  1. ;;
  1. ;; The browser displays a representation of the GUI Tree View accessible
  1. ;; via the CPRS GUI - Options - Edit Templates... or Edit Shared Templates...
  1. ;;
  1. ;; This representation allows users to find, view/verify the entry in
  1. ;; File #8927 via the CPRS GUI template editor. Because the template editor
  1. ;; allows long lines, entries in this file are NOT to be edited or viewed in
  1. ;; FileMan due to potential issues with wrapping fields or objects incorrectly.
  1. ;;
  1. ;; Example:
  1. ;;
  1. ;; IEN: (Internal Entry Number)
  1. ;; <Shared Templates>
  1. ;; <Education Templates>
  1. ;; - Blank/Broken Template [(Line #)]
  1. ;;
  1. ;; Press <PF1>+Q or <CNTRL>+E to exit the browser.
  1. ;;
  1. ;; Tip: If your keyboard doesn't have a separate 10-key keyboard (like a laptop),
  1. ;; your emulator should have a "Virtual Keyboard" so that you can access
  1. ;; the PF1 (and more) keys via the "Show or hide terminal keyboard." button.
  1. ;;
  1. ;;EOM
  1. ;
  1. PART05 ;
  1. ;;
  1. ;; PRINT/EMAIL will allow the user to print or email the analysis results to a
  1. ;; device of their choosing or a mail message to their account.
  1. ;;
  1. ;; Tip: You can PRINT the results and choose P-MESSAGE as the device to send the
  1. ;; email with a custom subject and multiple recipients.
  1. ;;
  1. ;; Press <PF1>+Q or <CNTRL>+E to exit the browser.
  1. ;;
  1. ;;EOM