Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hanging Screen Scrap

Status
Not open for further replies.

VAPharmR

Technical User
Aug 16, 2013
7
US
I’m new to the posting in the form community and hesitant to insult the talent
I have seen posted here and interested in learning to help others in the process.

My background is not coding and I have learned to code by observing the work and like
of this of this community.

Attachmate Reflection Suite for X 14.0.6029
Reflection for UNIX and OpenVMS
Version 14.0.6 build 687 32-bit

'For purpose of Chronic Pain Management
Working Date Range Calculator within Reflections- with following result.

Selected 30 Day
Original [11/04-12/3/2014 Inclusive]
Rf x 4 [11/06-12/05; 12/06-01/04; 01/05-02/03; 02/04-03/05; 03/06-4/4/2015]

Objective-Parse Number of Refills and Day Supply from screen

Start Date 'CurDat ‘Current Date by Default or users own.
Dim numRefills As String '’ Number of Refills Defaults to 30 Day;
Dim daySupply As String ‘ Default to 30 ‘for Class II Narcotics or User Defined.

This side of having a dynamic screen scrapping table this is my attempt to find an answer.

'==================================Screen Data===========================================

(8) Days Supply: 30 '8 not univeral; may change based on screen edits
(10) # of Refills: 5 (11) Routing: MAIL '10 not univerasl

'==================================Code Below============================================
Code:
Sub gNumRef_Test()
'Get Number of Refills - daySupply

    Dim numRefills As Integer
    Dim daySupply As Integer
    Dim Found As Integer
    Dim numLine As Integer
        
    Dim arraySrchNumRefill(1 To 2) As String    'Case Select for status of "of Refills: "
        arraySrchNumRefill(1) = "Enter RETURN to continue:"
        arraySrchNumRefill(2) = "? Yes//"
        
    Dim LF As String                            ' Chr(rcLF) = Chr(10) = Control-J
    Dim CR As String                            ' Chr(rcCR) = Chr(13) = Control-M
    LF = Chr(Reflection2.ControlCodes.rcLF)
    CR = Chr(Reflection2.ControlCodes.rcCR)
    Const NEVER_TIME_OUT = 0                     'prevents macro Endless Loop

On Error GoTo ErrorHandler

    With Session
        .CapsLock = True

        numRefills = 0
        daySupply = 0
        Found = 0
        numLine = 0
    
'********* Macro searches for 'of Refills: ' and makes sure its on the screen ******************
        .Wait "00:00:01"
        .StatusBar = "searching list for Number of Refills"
        .Transmit "SL" & CR 'search list
        .Transmit "of Refills: " & CR

        Select Case .Parent.Application.WaitForStrings(arraySrchNumRefill)
           Case (1)
                .Transmit "+" & CR    'Press Return to continue
           Case (2)
                .Transmit "N" & CR    'Refill Found; Find Next? No

'A...... N and CR is ignored    'LEAVING PROMPT ON SCREEN  ......................................>
'B...... ACTIVE SCREEN PROMPT:  "Find Next  "of Refills: '? Yes//"  .............................>
'............................................................> GoTo C............................>
                
        End Select

'********* Screenscraping for 'of Refills: '******************************************************
        .Wait "00:00:01"
        Found = .FindText("of Refills: ", 0, 0)
        MsgBox Found
'C....> Found = -1      'Value of Found
'D....> Macro Terminates here   '.............................. GoTo to Line Before.............>E

      If Not Found Then     '# of Refills
        MsgBox "Number of Refills Not Found, exiting macro."
      Exit Sub
      Else      'found # of Refills
               numLine = .GetText(.FoundTextRow, 0, .FoundTextRow, 1)     'captures the line#
'E....> Macro Terminates here
                MsgBox numLine
               numRefills = .GetText(.FoundTextRow, 74, .FoundTextRow, 75)'captures refills remaining
                MsgBox numRefills
               daySupply = .GetText(.FoundTextRow, 78, .FoundTextRow, 79) 'captures days supply
                MsgBox daySupply
        End If
    
    End With
Exit Sub
ErrorHandler:
    Session.MsgBox Err.description, vbExclamation + vbOKOnly
'G....> Error Type Mismatch

End Sub
 
Hi,

Is it true that the specific data you are searching for is not located in specific rows/columns?

I've always worked with transactions that returned data in a specified format. For instance, I constructed a table that described the data contained on each transaction/screen. I would grab ALL data from the screen, parse it and write it into an Excel sheet, driven by a list of key lookup values in Excel as well. I might get thousands of screens of data in just a few minutes.

So I'm wondering WHAT you're trying to accomplish rather than HOW you're going about doing it.
 
Thanks for the preliminary answer to a better question.

Forty-Eight years ago a TV series called[highlight #F57900] Star Trek created in the public mind a fantasy of technology[/highlight][highlight #8AE234][highlight #8AE234][/highlight][/highlight] that seems so far out there it would take light years to reach our desktop... No one would have believed that communicators would become everyday cell phones and star ship voice navigation would be common place in our cars or on our phones.

The administrative side of the Department of Veteran Affairs is doing their best to dot every “i” and cross every “t” for patient safety. But there is a serious lag it the software tools needed by those on the front lines to accomplish the task. Society has a right to expect care for those who have served to preserve our freedom. We must however match the need with our priorities and the political will to accomplish the task.

[highlight #3465A4]The pharmacy software in current use looks like it came right out of a time capsule from mid 1980’s[/highlight]. The sad part is that it’s basic function is no better than an electric typewriter on top of a file cabinet of data from 1986.

VistA emulation with Attachmate Reflections VBA is a door that few front-line users have known was there. The problem is how to open the door. If we fail to recognize appropriate channels politics, bureaucracy and fear will masquerade as progress.


The software for pharmacy software is in the public domain and may be found with a web search : ehealth va.gov VistA Monograph.
VISTA is built on a client-server architecture, which ties together workstations and personal computers with graphical user interfaces at Veterans Health Administration (VHA) facilities, [highlight #EDD400]as well as software developed by local medical facility staff. VISTA also includes the links that allow commercial off-the-shelf software and products to be used with existing and future technologies[/highlight].

That may look really good on paper but it means nothing if on the front lines if the mindset is business as usual. The demand on those on the front lines of patient care is going through the roof; Outsourcing care to the private sector where needed will do nothing to resolve the crisis of on IT resources without the tools to keep up with the need.

Specific Data = X is variable; Y is variable; occasionally parked at specific col, row for easy GetText use.
The efficiency of time would merit universal code that with index management could more easily adapt to a given need.



[highlight #FCE94F]The real answer to-
I'm wondering WHAT you're trying to accomplish[/highlight]

Unless the steps to accomplish the goal are small enough in the beginning to demonstrate to one and all, this is not vapor ware, it working….dumb as a rock to claim otherwise.

I began experimenting with VBA screen scrapping in May. With some assistance in those early days from Attachmate I was able to piece together code to pull the SSN from the screen, remove the dashes and call the website for postal tracking (in less than 10 seconds).

The manual time required is nothing less than 30 seconds. That is more than 2 wasted hours per day.
(No extra cost for equipment, just better utilization of time, better tools to call center, better patient care)

Regardless of who has the opportunity to solve these problems;

Simple cookbook 'like' database look-up automated could significantly improve resources for patient care.
Liver patient These drugs Specific Labs, in real time.
Cancer patient These drugs Green Light/Red Light
Chronic Pain 6 month Get Morphine Equivalents/Day over last 6 months.

(80% time of clinical pharmacist is spent looks stuff up- the then becomes, can it be user friendly and why not sooner than later.)


 
Hey, I'm with you! You went far deeper in the WHAT than I anticipated, but I get your passion.

I still need to know if a specified screen has a [highlight #FCE94F]fixed structure[/highlight], or will you find, for instance, Days Supply: or # of Refills: in [highlight #FCE94F]various places[/highlight]? As I previously stated, my experience is the former, and the parsing technique might vary based on this fact.
 
Response and Considerations:

'Row containing Rx# below Start Page 1 - May not be first line of Page 1
' Drug Interaction Warning may bump Rx# multiple lines
'
'Label Names for fields of interest will precede colon col, = 21

'Line containing "# of Refills" may not always be Edit Line (11)
'
[highlight #729FCF]' Sample Pages 1 to 3 Follow 'Similar screens found in public domain cited above[/highlight]

[highlight #EDD400]'>>>>>>>>Start Page 1 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>[/highlight]
Code:
Rx#: 1000000E
 (1) *Orderable Item: ACETAMINOPH 325-HYDROCODONE 10MG (NORCO) TAB
' (2)       CMOP Drug: ACETAMINOPH 325-HYDROCODONE 10MG (NORCO) TAB
'                Verb: TAKE
' (3)         *Dosage: 1 TABLET(S)
'              *Route: ORAL
'           *Schedule: Q6H PFPN
' (4)Pat Instructions: UP TO EIGHT (8) TABS/DAY *MAY CAUSE DROWSINESS* NOT TO
'                      EXCEED THREE (3) GRAMS OF ACETAMINOPHEN PER DAY.
'                      {6/22-7/21; 7/22-8/20; 8/21-9/19; 9/20-10/19/14}
'                 SIG: TAKE 1 TABLET(S) BY MOUTH EVERY SIX (6) HOURS IF NEEDED
'                      FOR PAIN UP TO EIGHT (8) TABS/DAY *MAY CAUSE DROWSINESS*
[highlight #EDD400]'>>>>>>>>Start Page 2 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>[/highlight]
' NOT TO EXCEED THREE (3) GRAMS OF ACETAMINOPHEN PER DAY.
' {6/22-7/21; 7/22-8/20; 8/21-9/19; 9/20-10/19/14}
' (5) Patient Status: OPT NSC
' (6) Issue Date: 06/14/14 (7) Fill Date: 06/16/14
' Last Fill Date: 06/16/14 (Mail, Released)
' Last Release Date: 06/16/14 (8) Lot #:
' Expires: 06/15/15 MFG:
'(9) Days Supply: 30 (10) QTY (TAB): 120
'(11) # of Refills: 3 Remaining: 3
'(13) Routing: MAIL (14) Copies: 1
'(15) Clinic: PDICC POST DEPLOYMENT NEW
'(16) Division: VAMC XXX-OUTPTRX (000) '
[highlight #EDD400]'>>>>>>>>Start Page 3 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>[/highlight]
'(17) Pharmacist:
'(18) Remarks: 1000000D FILLED 6 TIMES FIRST MAIL OUT ON 01/20/2014
'(19) Counseling: NO
'(20) Refill Data
' Last Fill Date: 06/16/14 (Mail, Released)

Screen Spacing may be lost in posting- Text File Attached shows accurate spacing
 
 http://files.engineering.com/getfile.aspx?folder=5852b04d-ab07-4a0a-956f-568765745a6a&file=VAPharmR_SampleScreen.txt
Screen Sample-Second Try

Code:
'>>>>>>>>Start Page 1 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
'Rx#: 1000000E
' (1) *Orderable Item: ACETAMINOPH 325-HYDROCODONE 10MG (NORCO) TAB
' (2)       CMOP Drug: ACETAMINOPH 325-HYDROCODONE 10MG (NORCO) TAB
'                Verb: TAKE
' (3)         *Dosage: 1 TABLET(S)
'              *Route: ORAL
'           *Schedule: Q6H PFPN
' (4)Pat Instructions: UP TO EIGHT (8) TABS/DAY *MAY CAUSE DROWSINESS* NOT TO
'                      EXCEED THREE (3) GRAMS OF ACETAMINOPHEN PER DAY.
'                      {6/22-7/21; 7/22-8/20; 8/21-9/19; 9/20-10/19/14}
'                 SIG: TAKE 1 TABLET(S) BY MOUTH EVERY SIX (6) HOURS IF NEEDED
'                      FOR PAIN UP TO EIGHT (8) TABS/DAY *MAY CAUSE DROWSINESS* 
'>>>>>>>>Start Page 2 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
'                      NOT TO  EXCEED THREE (3) GRAMS OF ACETAMINOPHEN PER DAY.
'                      {6/22-7/21; 7/22-8/20; 8/21-9/19; 9/20-10/19/14}
' (5)  Patient Status: OPT NSC                                                   
' (6)      Issue Date: 06/14/14               (7)  Fill Date: 06/16/14           
'      Last Fill Date: 06/16/14 (Mail, Released)                                 
'   Last Release Date: 06/16/14               (8)      Lot #:                    
'             Expires: 06/15/15                          MFG:                    
'(9)      Days Supply: 30                    (10)  QTY (TAB): 120                 
'(11)    # of Refills: 3                           Remaining: 3                  
'(13)         Routing: MAIL                  (14)     Copies: 1                  
'(15)          Clinic: PDICC POST DEPLOYMENT NEW                                 
'(16)        Division: VAMC XXX-OUTPTRX (000)                                    '
'>>>>>>>>Start Page 3 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
'(17)      Pharmacist:                                                           
'(18)         Remarks: 1000000D FILLED 6 TIMES FIRST MAIL OUT ON 01/20/2014
'(19)      Counseling: NO                                                        
'(20)     Refill Data                                                            
'      Last Fill Date: 06/16/14 (Mail, Released)
 
Good! I'm starting to get a picture of what you have. In particular, a row does not necessarily correspond to an Edit line, and the colon is in col 21, meaning the text(1:20) is headings and (23:80) is data. I'm guessing 80.

BTW, could not get response from ehealthva.gov.

So what's the objective here?

Given a single RX#, print out the screens?
Given a list of RX#, print out screens for each?
Or only print out selected data, rather than entire screens?

I take it you only have Attachmate' Extra Basic, and not Excel on your PC, where VBA might be used?
 
Can you copy what the screen looks like before the data is entered and paste into a text file and post as you did on 9 Nov 14 1:49.

I am particularly interested in how Page 2 is structured as empty.
 
For the understanding of Software Methods and Objective:

Code:
'
'    From Line 6 of original post: 
'    Attachmate Reflection Suite for X 14.0.6029 
'    Reflection for UNIX and OpenVMS
'    Version 14.0.6 build 687 32-bit
'
'    What I have shown represents the data needed for coding 
'     (trying not to overwhelm with more information than may be needed). 

'     Actural Screen Line one below:
'     Identifies what Vista code template will be used: (Pending OP Orders (ACTIVE) ) 
'============  Sample Header Below =============================================
'
'    Pending OP Orders (ACTIVE)    Sep 04, 2014@13:57:29          Page:    1 of    3
'    ZZFLINTSTONE,FRED WILBERT MR
 '
 '   DOB: DEC 4,1947 (66)                             Wt(kg): 64.41 (08/18/2014)
 '   SEX: MALE
'    CrCL: 44.1(est.) (CREAT:1.5mg/dL 8/18/14)       BSA (m2): 1.75 
''
'    Rx#: 1000000E
'============  Sample Header Above =============================================
'			
'		ACTIVE WORK AREA
'
'=======(Identified) Page One (Above)=====  Sample Footer Below =======================
'
'    the Plus Sign: "+ Enter ?? for more actions" ' IDENTIFIES active processing fields.
'    Below  Plus Sign "+": Active commands for order processing.
'
'    DC   Discontinue          PR   Partial              RL   Release
'    ED   Edit                 RF   (Refill)             RN   (Renew)

'=======(Identified) Page One (Above)=====  Sample Footer Above =======================

'+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
'		
'    PRIMARY PHAMACY PROCESSING BEGINS 
'       with the information as shown on earlier post.
.'
'    Order entered by the doctor IS ELECTRONIC;
'     The flow for Rx VistA processing is poor.
'
'    Vista processing IS NOT a easy reading book.
'    It's more like physics- cross reference, 
'       Problem this page, 
'       Formula 2 pages before
'      (must continually flip  back and forth 
'          between pages to get it pieced together.)

'    Half the directions for use may be on Page One 
'        and half on Page Two)

'    For the clarity of patient/provider/pharmacy: 
'    Pharmacy puts a date range on label for chronic pain prescriptions. 
'
'    Basic information for use of Providers/Pharmacy/Phone Support/ 
'    Minimize need for research on next order.
'
'	New Order needs to be EDITED. 
'	DAY SUPPLY and # OF REFILLS info is NOT PRESENT ON EDIT SCREEN.
'
'	Automating a gDaySupp macro would get value for both strings 
'	   before entry into EDIT SCREEN for edit of LINE ITEM (4)
'
'	Those strings would then default into macro 
'            for Date Range Calculator (VistA enable macro).

'     PRIMARY OBJECTIVE: 
'        -Day Supply and Number of Refills, for automation 
'        -Time consuming
'        -Room for Error in simple manual data entry of Date.
'
'+++++++++++++++ Public Domain Sources +++++++++++++++++++++++++++
' 
'  To accomodate formum guidelines, I abreviated text to search for: 
'
  'Most current but NOT the best source to see actual screens.
  'Google "VistA Monograph" and look for Oct. 2, 2013 version.
  'Document for "Pharmacy: Outpatient Pharmacy" software   
  'specifications
  '
  '
  'Best Information (Older by better for sample screens).
  'Google search "Vista pharmacy outpatinet screen
  'PDF for outpatient pharmacy US Dept. of Veteran Affairs
  'Technician User 1997
  'pg. 262
  'Image of User Screen:
  'Clerk Finishing Pending Order 
'++++++++++++++++End Public Domain Source ++++++++++++++++++++++++
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top