Personal tools

Useful Code

Code that enhances the OSCAR user's experience. This started out as a collection of various types of files with code that could be inserted into new eforms to improve/enhance their performance. It has now expanded to include code that can be added to enhance the way OSCAR works in Firefox (Greasemonkey scripts), and other code/pdfs/forms that can be added on to OSCAR, or used by the office to improve work flow.
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 the many contributors for these scripts.
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.
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/ Once you have these numbers they will need to be manually entered into the code where you see fid= and doc_no=: function eLink () {"../eform/efmformadd_data.jsp?fid=14&demographic_no="+RegExp.$1+ "&apptProvider=&appointment="); } function dLink () {"../dms/"); } 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 tag add the following reference ============== for the bottom in the buttons section add the following on the line after the that locates where the subject line and buttons go =========  
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 for prescriptions and eforms
Update Dec 5 2015 - From Darius Opensource - I apologize for the delay, Dr. Chang. Attached are SignaturePad(RxNeForms).htm and eFormSignatureInserter.user.js Tested with an Android tablet. Had no Apple devices available to test with. Since you specifically requested compatibility with Special Authority eForms, I am also attaching the Special Authority eForm this was tested with, SA_Update_2015_V10_signed.html SignaturePad(RxNeForms).htm will generate signatures for both Rx and eForms so it is compatible with the original signatureInserter.user.js for Rx. Feedback is welcome as always. Darius. P.S. A to-do item is scaling for the signatures while maintaining aspect ratio. The why that may be useful may become obvious once you start using it. I am going to leave that for the next version with multiple signatures which should not take as long as this one did to come to fruition. ----- Dependencies are on jsgraphics.js, jsgraphics_part2.js and mouse.js I am going to assume you already have them in your Oscar images if you have installed one of the Special Authority eForms using jsgraphics. ----- 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/' 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.
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,, 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 while in Firefox on Android. 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. > > > 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. >
Measurement Graphing Form
At 1/10th the size this code is easier to follow than the WHO While it defaults to INR (you probably have a patient or two with lots of measurements of that type) It will plot whatever measurement you ask it to by typing in the top left and clicking on plot. No dependency version and if you are David Page you need to put in the two slashes that his system seems to strip perhaps if I call it a txt file it won't get corrupted for testing (and cutting and pasting) the attached picture is a screen shot ================ Peter Hutten-Czapski Haileybury Ontario
Black Box technique
In searching for something as a high visibility substitute for a checkbox for very small inputs I have devised the Black Box technique In its simplest form its as attached someone else might find it useful as well This version works both in OSCAR and on the desktop.
Extract date joined from the demographics page for use in eforms
This concept was created by Peter HC with modification by David Page. Variations can be used to extract data from almost any page in OSCAR by simply altering the regular expression used to parse the page. Of course this depends on the formatting of the page in OSCAR and thus may need to be updated as versions change ***Warning*** works for version 12 - may not work for later version. This code draws the date joined information from the demographics page. For specialists, if the demographic is made up the day the referral is received, date joined = date referral received. This is useful for governmental demands for information with regard to waiting times to see a specialist (BC surgeons are now required to provide this information). Variations could likely be used to determine how long a patient has been in someone's practice etc. JohnR.
Code to Autopopulate the billing page
Created by David page: Attached is code that will allow an eform to be set up with a button that takes you to the billing page and autopopulates: 1) Referring doctors number (if you have this entered in demographics) 2) Billing code 3) Billing diagnostic code (These latter two require this information to be in the eForm- you can manually enter it into the text boxes or create your own js "quick select" to populate the text boxes) It will only work in BC(but should be adjustable for ON if needed) , and at the moment is only set up for one person in the clinic (I see this functionality being useful to specialists, not to GPs so I did not bother trying to make it universal) The code should be able to be added to other eForms (ie it is not meant to be a standalone eForm) I have not tried a real submission to MSP with it but see not obvious problems. Thank you to Darius for helping with the code, and to Peter HC for the database tags to make the code universal. David
Tutorial on how to paste text into the oscar editor - powerpoint version
Tutorial using Peter HC's WHO Growth chart as an example of correcting an eform in the OSCAR eForm editor by pasting text over the original eform
Tutorial on how to paste text into the oscar editor - PDF version
Tutorial using Peter HC's WHO Growth chart as an example of correcting an eform in the OSCAR eForm editor by pasting text over the original eform
Patient demographic intake
A pdf and some code centered around improving the initial intake of patient information. This sprang from a fillable pdf provided by Dr. Sedergreen. From Chris Sedergreen - description follows - I have created a 'fillable' PDF which is attached for anyone's interest. In my office it is e-mailed to the patient before they first arrive. At least it allows the MOA to enter the data when she has a 'quiet' moment. (OK, so no one's MOA's have quiet moments, but at least they can schedule time for this activity).
eform example of writing to the encounter pane.
This code was originally developed by Morgan Price's team in Victoria for their end of life module. Subsequently David Page has used the same code in the Youth Mental Health Module. This is a stand alone example of the code required and was created by David Page. It is provided for those who wish to add it to other eforms. ----- NB With this code, if you are adding to an existing encounter note - that is, if there is already an encounter note open - a pop up will appear. You can read it and click cancel, and you will be able to add the information from the eform to the open note. Somewhat counter-intuitive, but there it is. -----JohnR.
Re-ordering date in 2015-Sep-20 format
Provided by Dan Robibo and This is an appointment form - in the header there is a javascript to re-order the date for today and the appointment date. It is activated "onLoad" NB - currently there is not a database tag for Appointment Date. This form also has faxcontrol javascript in it that will show up as an error if this is not in your server. JohnR.
Signature Script Using Web based Jquery files
3 different examples supplied by Peter HC for adding signatures to forms.
Oscarizing radio boxes and check boxes
From Stanley Hurwitz : I've been having difficulty saving check boxes and radio boxes in Oscar. I realize that this has been addressed in the new eform generator, but the following helps to build from scratch. Oscar manages radio boxes differently: Normally radio boxes are each given a unique ID but with the same name. Saving radio boxes in Oscar will check ALL boxes in the group. 1. To save radioboxes in Oscar, they need to be converted to input boxes, each with it's own unique ID. To group as a radio group they require a unique class for each radiogroup. 2. To assign class rules, use a CSS that allows a class name plus a wild card rather than having to repeat the CSS rules for each radio group class. 3. To apply CSS rules to all radiogoups, use a second class name. 4. Small X-boxes don't fax well. This can be overcome by blacking out the entire checkbox. Firefox defaults to NOT printing back ground colors. Thus to print a black box, you cannot use a background black color. The trick is to use boxshadow with inset: boxShadow = "inset 0 0 0 1000px black" The attached HTML file demonstrates Stan

Document Actions


Download button



eForms button


 Customize button



Subscribe Button



Help button