Search the OSCAR Documentation
< All Topics
Print

Code Repository and Standards

Code Repository

OSCAR’s code repository is here on Bitbucket

The production branch is stable

Please make multiple changes into one branch and then submit a pull request to merge that branch into stable (it is easier to see and review the multiple changes that way), and tag Peter H-C as a reviewer.

Coding Pointers

Internationalization

OSCAR depends on the browser locale to signal which language to serve labels. Thus OSCAR is extensively i18n tagged with keys kept in resource files based on the language. For English we use oscarResources_en.properties to keep the key and its value. Both new and reworked code should avoid English UI labels and instead add values to the English language resource file.

UI Look and Feel

UI we try to keep it consistent with an older Bootstrap. You will note that the blue raised buttons for indicating the primary button class=”btn btn-primary” is a convention used throughout OSCAR to make the interface more intuitive.

https://bootstrapdocs.com/v2.3.1/docs/index.html

Font awesome should be used for icons and they are already in OSCAR
oscar/src/main/webapp/css/font-awesome.min.css

https://fontawesome.com/v3.2/cheatsheet/

The icons are black and can be styled whatever colour and size you want
Treat them as fonts for CSS

To link Bootstrap and Font awesome in an OSCAR JSP to use, add the following:

<link href="<%=request.getContextPath() %>/css/bootstrap.css" rel="stylesheet" type="text/css">
<link href="<%=request.getContextPath() %>/css/datepicker.css" rel="stylesheet" type="text/css">
<link href="<%=request.getContextPath() %>/css/DT_bootstrap.css" rel="stylesheet" type="text/css">
<link href="<%=request.getContextPath() %>/css/bootstrap-responsive.css" rel="stylesheet" type="text/css">
<link rel="stylesheet" href="<%=request.getContextPath() %>/css/font-awesome.min.css">
<link rel="stylesheet" href="../css/helpdetails.css" type="text/css">

When possible entertain using Data-tables (also embedded in OSCAR) for displaying tabular output.

UI Security

Don’t assume that the end user of OSCAR is benign or can’t be tricked to save malicious content into the database. Even with the login data is transfered to OSCAR potentially to be displayed (with malicious code being run) when a log file is displayed. You must assume that the database has untrustable content and escape it. OSCAR is using the OWASP library to prevent arbitrary injection.

Rather than

document.forms[0].notes.value = "<%= apptObj.getNotes() %>";

Include the library in the JSP and escape the content

<%@page import="org.owasp.encoder.Encode" %>

....
document.forms[0].notes.value = "<%= Encode.forHtmlAttribute(apptObj.getNotes()) %>";

TIP: do this at the last step before it becomes visible in the browser. If you don’t you risk missing bits or double encoding.

Stylecheck

Try to compile your code without unit testing to have the stylecheck plugin examine your code. Certain forms and approaches are deprecated (eg Vectors) to ensure consistency.

Libraries

Everything from Angular to Jquery to Bootstrap to Apache Commons libraries moves through a series of versions. For ease of maintenance please use EXISTING libraries in OSCAR unless they don’t work or are insecure.

Linking Master Record in Developed JSP
<%=request.getContextPath() %>/demographic/demographiccontrol.jsp?demographic_no=<%=patient.getDemographicNo()%>&displaymode=edit&dboperation=search_detail)

TIP: use<%=request.getContextPath() %> to link various items in OSCAR in a developed JSP.
<%=request.getContextPath() %> is the oscar folder: /var/lib/tomcat9/webapps/oscar

<%--

    Copyright (c) 2001-2002. Department of Family Medicine, McMaster University. All Rights Reserved.
    This software is published under the GPL GNU General Public License.
    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License
    as published by the Free Software Foundation; either version 2
    of the License, or (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

    This software was written for the
    Department of Family Medicine
    McMaster University
    Hamilton
    Ontario, Canada


--%>

Database Schema

The database schema has not changed radically from version to version. The following section should document some of the more ‘interesting’ parts of the database. This can be very useful if you are converting from another EMR or older version of Oscar.

Many of the tables are part of the CAISI project. I don’t know if CAISI is still being developed. Most of the CAISI specific tables MUST exist, even if they are empty.

Note: This section is currently (as at May 2022) being slowly updated.

Special Columns

program_id: is a unique number to identify your Oscar site. This is a CAISI feature. Normally, it is 10016, but any value can be used. Use the following query to determine the program_id for your installation.

select id from program where name = 'oscar'
Demographic

The demographic_no is the unique patient/demographic record. It can be defined as demographic_no or demographicNo

demographic:

demographiccust: is an optional table for additional demographic info. 
cust1 contains the nurse provider_no, 
cust2 contains the resident provider_no, 
cust3 contains the patient alert, 
cust4 contains the midwife provider_no, 
content contains the patient note.

demographicExt : uses pairs of key_val and value for additional demographic info.  key_val can be aboriginal, area, cytolNum, demo_cell, EmploymentStatus, ethnicity, fNationCom, given_consent, HasPrimaryCarePhysician, hPhoneExt, informedConsent, paper_chart_archived, paper_chart_archived_date, paper_chart_archived_program, phoneComment, PHU, primaryEMR, privacyConsent, rxInteractionWarningLevel, statusNum, usSigned, wPhoneExt

admission: is a parallel table with demographic. If an admission record is missing, the demographic will ‘disappear’ from the GUI. The client_id is the demographic_no.  Note: this table can be truncated and rebuilt from the demographic table. That’s usually easier than finding and adding missing records. Make sure you are using the correct program_id (see ‘Special columns’) ! The example uses a default provider if it does not exist in the provider table.

TRUNCATE TABLE oscar_15.admission ;
INSERT INTO oscar_15.admission
( client_id, program_id, provider_no, admission_date, admission_from_transfer, admission_notes, discharge_from_transfer,
admission_status, team_id, temporary_admission_flag, automatic_discharge, lastUpdateDate )
( SELECT
demographic_no , '10016' , IFNULL(provider_no, '999910') , curdate() , 0 , '', 0 ,
'current', NULL , 0 , 0, curdate()
FROM oscar_15.demographic ORDER BY demographic_no ) ;
Documents

document: 1 record per document. Note: There is no demographic_no in this table. See ctl_document where module = ‘demographic’

ctl_document: links documents to other tables. module specifies the related table [ demographic / provider ]. module_id is the demographic_no OR provider_no OR 2147483647 (what is that?)

casemgmt_note_link: links an encounter note with a document. The casemgmt_note_link.table_name specifies the link [1=? / 2=drugs / 3=? / 4=? / 5=documents / 6=eform_data.fdid / 10 =? ]

Medications

drugs : regional_identifier is defaulted as NULL. It is the medication DIN number. If it is NULL, the screen will crash.

Encounter

 

Table of Contents