Useful Code
A collection of various types of files with code that can be inserted into new eforms to improve/enhance their performance
- 4 signature form
- Greasemonkey Scripts
- Greasemonkey is an add on for Firefox. It allows for execution of java script on specific browser pages. Examples include renaming Labs and jumping days/weeks/months in the appointment calendar. Greasemonkey must first be installed on the computer being used. After greasemonkey is installed, any file ending in ".user.js" can be opened with firefox and it will be added to the firefox plug ins. Thanks to Andrew Renner & Darius Opensource for most of these.
- Two Page form with "X" boxes and image visualization
- Code from A Renner, that allows for X boxes instead of check boxes. Has the advantage of working on 2 page forms (the drawn check marks do not). Need the css file for this to work (load in image library). Also has code to allow visualization of images without changing the source code.
- Calendar
- Simple example of a calendar that can be added to an eform ( to pick a date for a data input)
- University of Ottawa Heart Institute Quit Smoking
- Smoking Cessation Plan - has a link to a patient handout in edocs. The number of an edoc has to be determined for the individual server.
- Fraser Health OR consent form with buttons which go to other eforms
- OR consent form with 2 buttons at top. One to the OR booking form, One to the Pre-op test form. Form numbers are specific to the server, and as such will need to be changed on an individual basis. latest version removes the issue of "the middle page" and the problems getting back to the original form. If you are asked if you want to leave the form, the answer is no, then you can get back to the initiating form and print/submit it.
- Assigning Subject Value
- Code line that assigns a value to the subject line of an eform. This allows information to "pop up" when the cursor is hovered over the eform in the patient encounter. To quote Peter Hutten-Czapski "The important bit is the onchange which assigns the value of the text to the subject Note that it is necessary to have the name attributes set for both subject and the form element"
- Eform Linker By David Page
- Submitted By David Page - Thanks to collaborative work of Darius Opensource, John Robertson and myself, we now have new code to increase the power of eForms. We are now able to create "buttons" in eForms that link to other eForms, eDocs or even to other aspects of the patient file. Attached is the template code. For those that are interested in a demonstration, the attached code can be loaded as an eForm and run BUT you have to use it in an actual PATIENT chart as it requires a demographic number to work. Couple of idiosyncrasies I have noted- the Rx will not paste into the encounter(but does save in the Rx module), billing you need to manually insert provider and date. Caveat: For the linking to eForms and eDocs: All eForms and eDocs when uploaded into OSCAR servers acquire a unique SEQUENTIAL ID number. Unfortunately this number is going to be different between servers so each server will have to manually adjust this number for the eForm or eDoc target. This is actually very easy to do though: Open the eForm from any location and look in the url for the fid number eg https://../eform/efmformadd_data.jsp?fid=479&demographic_no=27853&apptProvider=&appointment= Open the eDoc and look in the url for the doc_no eg https://../dms/ManageDocument.do?method=display&doc_no=125166&providerNo=100 Once you have these numbers they will need to be manually entered into the code where you see fid= and doc_no=: function eLink () { window.open("../eform/efmformadd_data.jsp?fid=14&demographic_no="+RegExp.$1+ "&apptProvider=&appointment="); } function dLink () { window.open("../dms/ManageDocument.do?method=display&doc_no=100"); } I have put in random fid and doc_no's into the example code so it will work for demo purposes but will be unpredictable in what it brings up- I think patient specific documents and eDocs are in the same table so it may bring up a different patient specific document... This code will have many different uses- linking handouts to eForms, the ability to say link the SPA form for Spiriva to the COPD action plan as simple examples. I am working on an End of Life eForm (for the PSP module) and it will have a lot of similar links. DavidP
- Anticoagulation Bridging Therapy
- This is an example of how to use the built in calendar in OSCAR (as detailed in the "calendar" html Peter HC provided) and then calculate additional values (dates) from the first date input (code by David P). This particular example uses the calendar to input the date of a procedure and then calculated dates for stopping and starting anticoagulation therapy based on a protocol. to Quote David P: The basis is Date.js (google this for documentation) and it appears that OSCAR has it installed already as one does not have to include the big code. My struggle was working out how to pick up the date generated by the calender, the rest was fairly straight forward. There is a quirk- if the calender puts out 2011-12-21, the "pick up" is 2011-12-20. I have no idea why this happens, but it is easy enough to correct for. I have set the ASA to stop 10 days before....not sure what this should actually be. function advisedate() { ----this line parses "xml_vdate" generated by the calender for the procedure date---- var myDate=new Date(Date.parse(document.getElementById('xml_vdate').value)); ---put: alert(myDate) to see the output---- ---this line sets that date as the "date object" to be worked on. The -9 subtracts 9 days from the date object (there is already 1 day missing as I mentioned, not sure why. So this is set for a date 10 days prior to the procedure date---- myDate.setDate(myDate.getDate()-9); ----These lines now work with the "date object" to convert back to a usable format - get Date returns the day of the month as a number 0-31 (ie 21) get Month the month as a number BUT January is 0, Feb is 1 etc so one needs to +1 to make it useful. Weekday returns a number, Sunday is 0, Mon 1 etc----- var now = new Date(); var today = myDate.getDate(); var month = myDate.getMonth()+1; var year = myDate.getFullYear(); var weekday=new Array(7); weekday[0]="Sun"; weekday[1]="Mon"; weekday[2]="Tues"; weekday[3]="Wed"; weekday[4]="Thurs"; weekday[5]="Fri"; weekday[6]="Sat"; -----This line puts it all together so that the date can be outputted in whatever order you want------ document.getElementById('asa').value = (weekday[myDate.getDay()]+","+year+"/"+month+"/"+today); }
- Perinatal Services of BC Levels of Service Document
- Script at the end of the header allows for autorotation so that you can print landscape eforms as portrait eforms without changing the printer settings back and forth. There is a <div class="page"></div> around the <form method="post" action="" name="FormName" id="FormName" > that selects what gets rotated. To Quote David Page: I have it in a form, but it is very temperamental and have to adjust the width/ht margin for different computers...
- Intake Forms
- Automated intake forms for O&G with push and pull to measurements, the encounter form, and the history box. Also employs 'eform magic' to write to other parts of the chart. Also included are some templates for the rich text letter to use the information gathered in the intake forms to write the letter. JohnR.
- Fax Code for Oscar 12.1 and above - Provided by Peter HC
- Assuming that others might be interested this can easily be added to existing eforms being written without much effort to allow them to work for earlier Oscars and Oscar_12_1 with eForm faxing configured. Note that adding these phrases will neither show, print nor fax in earlier Oscars but will appear when desired when you upgrade. so for top of each eForm just after the <head> tag add the following reference ============== <script type="text/javascript" src="${oscar_javascript_path}eforms/faxControl.js"></script> for the bottom in the buttons section add the following on the line after the <div class="DoNotPrint" ....> that locates where the subject line and buttons go ========= <div id="faxControl"> </div>
- PTSD Form Created by Chris Sedergreen & John Yap - contains code for pop up boxes and does calculations
- Example of Specialist version of Rich Text Letter
- With full credit to Peter HC - this is a specialist version of the BC Rich Text Letter with some templates for use. Meant to be an example to build off of for other specialists. John Robertson.
- The use of measurements with non matched names and ids for extended use of inputs
- When creating an input that pushes measurements to OSCAR if the name= and the id= are not the same more manipulation of the input data can occur - see the explanation in the text file
- Signatures using the smart phone
- Attached are SignaturePad.htm and SignatureInserter.user.js SignaturePad.htm needs be uploaded to Oscar's eForm image folder. SignatureInserter.user.js is a Greasemonkey script. On the smartphone, bookmark the following link to easily access the Signature Pad from Oscar's mobile schedule page (The page with the 'Menu' button on the left and the 'Today' button on the right. This is the default page on logging into Oscar on the smartphone) javascript:document.location='../eform/displayImage.do?imagefile=SignaturePad.htm' On the smartphone, sign on the Signature Pad and click 'Send Signature' On the desktop/notebook, click the 'Insert' button below Signature Pad to insert the signature. Signature Pad uses the scratch pad to transfer the signatures. It preserves the existing contents of the scratch pad but it is preferable that the scratch pad be left empty while the Signature Pad is in use.
- oscarOpenPublicEDoc
- Created by Darius Opensource - As Dr Page noted, it would be useful to be able to open documents by name. There are two options for implementing this, either on the server as oscarOPEN was implemented, or in the browser. This is a proof of concept using the latter route, i.e. in the browser using Javascript. The attached eForm demonstrates the code. To use oscarOpenPublicEDoc in an eForm, oscarOpenEDoc.js needs to be included by adding the following: <script type="text/javascript" src="${oscar_image_path}/oscarOpenEDoc.js"/></script> Then to add a link to , as an example, 'Document A', add the following: <a href="javascript:oscarOpenPublicEDoc('Document A');">Document A</a> Feedback always welcome. Darius.
- JS file for opening edocs
- A workaround for viewing PDF's from the image directory in 12.1
- Created by Darius Opensource: The attached eForm demonstrates a workaround for opening and viewing a PDF from the image directory. This works on Firefox and Internet Explorer. It does not work on Chrome. However, using this as a base, it may be possible to develop browser agnostic solution. Feedback always welcome. Darius.
- Secure printing for Oscar from Android devices
- On 13-04-24 09:09 PM, Darius Opensource wrote: > Quoting Dr Klein below. > > > Google CloudPrint works very well for Android devices. By using it you would of course be trusting Google to handle your confidential printouts... > > That uncertainity led me to develop an alternative, tentatively named Oscar LocalPrint. To test this proof of concept the following is required: > > A. An Ubuntu workstation with shared printers. (Ubuntu is the most familiar to Oscar users but any flavour of Linux will do) > > B. One or more Android devices as desired. C. Firefox on Android. > > D. Oscar LocalPrint (as opposed to Gioogle CloudPrint) , an extension for Firefox for Android. The attached file, OscarLocalPrint.zip.xpi, is it. > > > > 1. To allow the Ubuntu workstation and the Android devices to communicate securely, the following needs to be added to /etc/cups/cupsd.conf > > DefaultEncryption Required > ServerCertificate /etc/cups/ssl/server.crt > ServerKey /etc/cups/ssl/server.key > > , and to allow Android devices on the local network to access the shared printers, do the following: > > Find the following entry in cupsd.conf: > > <Location /> Order allow,deny </Location> > > Add the following between <Location /> and </Location > > > Allow from 192.168.* > > , so the edited entry is as follows: > > <Location /> Order allow,deny Allow from 192.168.* </Location> > > > 2. To install the extension in Firefox for Android, tap the link to OscarLocalPrint.zip.xpi while in Firefox on Android. OscarLocalPrint.zip.xpi is essentially a zip archive renamed. It contains two files, bootstrap.js and install.rdf, both which are also included as seperate attachments. Since the CUPS printing system is using self signed certificates, Firefox for Android on each Android devices needs to told to accept the self signed certificates. To do so, do the following: > > Suppose the name of the Ubuntu workstation on the network is UbuntuOne, then open the following link in Firefox for Android. > > https://UbuntuOne:631/ or use its IP address, e.g. > https://192.168.0.2:631/ > > Firefox will offer the choice refusing or accepting the self signed certificates. Accept and add an exception for the certificates. This is necessary for the Oscar LocalPrint extension to securely connect to the Ubuntu workstation. > > 3. Once the extension is installed, navigate to the Rx page of a test patient and click 'Save and Print', enter the name or the address of the Ubuntu workstation in the 'Print Server' field and enter the printer name in the 'Printer' field and click 'Send to Printer' Both 'Print Server' and 'Printer' entries will be saved for reuse. > > Feedback always welcome. > > Darius. > > P.S. > OscarLocalPrint.user.js is the desktop version of Oscar LocalPrint, a Greasemonkey script, for troubleshooting. >

