Personal tools
You are here: Home / OSCAR EMR version 15 / 2.0 The "Classic" Interface / 2.4.1 eForm Magic part A - Standard Tags

2.4.1 eForm Magic part A - Standard Tags

Advanced techniques for making eForms in Oscar 15 Including Database pulls - simple, measurements, enhanced and extended as well as Templates to paste into ...

Pulling Data from Oscar using Database Tags

Standard Database Tags

 The following tags from Oscar15 are designed for users to use if they want certain fields to be automatically filled out with information from the patient's chart.

The tag should appear in the following style oscarDB=<tag> (note lack of quotation marks) as in the following example:

<input type="text" name="pname" id="pname" oscarDB=patient_name>

The following is a list of all the standard database tags available

Tags are read (display) only except those marked as (u) tags which the eform can also update the database based on user input.

* marked tags have been added to OSCAR_15 since June 2016

oscarDB tag Description Example
time system time in this time zone
12:34:23
today system date
2016-01-29
appt_date appointment date
2015-12-11
current_form_id fid of current eform
number
current_form_data_id fdid of current eform
number
current_user logged in user
Hutten-Czapski, Peter
current_user_fname_lname logged in user
Peter Hutten-Czapski
current_user_ohip_no OHIP provider No
150692
current_user_specialty_code OHIP specialty
00
current_user_cpsid College Registration
54345
current_user_id Oscar User No
121
current_user_signature Oscar User Signature
MD (entered from Pref, Edit your Signature)
patient_name Upper Case Name
MACDONALD, JOHN A
first_last_name Mixed Case Name
John a Macdonald
patient_nameL (u) Last Name
MACDONALD
patient_nameF (u) First Name
JOHN A
patient_alias (u) Patient Alias as per demographic
Old Chieftain
patient_id Oscar Generated Demographic No
3781
label SURNAME, PROPER
Address line
Telephones
DOB HIC
MACDONALD, JOHN A
Box 815, 16 Whitewood Ave., New Liskeard, ON P0J 1P0
Tel:705-647-4399(H)  (W)
03/06/1938(F)  HIN:7999962999CR
address Address
City Postal
Box 815, 16 Whitewood Ave.
New Liskeard, ON P0J 1P0
addressline one line address
Box 815, 16 Whitewood Ave., New Liskeard, ON P0J 1P0
address_street_number_and_name street and number
Box 815, 16 Whitewood Ave.
province 2 digit province
ON
city City
New Liskeard
postal Postal Code
P0J 1P0
dob date of birth
03/06/1938 (d/m/y)
dobc dd/mm/yyyy
13/06/1938
dobc2 yyyy/mm/dd
1938/06/13
*dobc3 mm/dd/yyyy 06/13/1938
dob_year yyyy
1938
dob_month mm
06
dob_day dd
03
NameAddress Name
Address
MACDONALD, JOHN A
Box 815, 16 Whitewood Ave., New Liskeard, ON P0J 1P0
hin HIN and Version
7999962999 CR
hinc HIN
7999962999
hinversion Version Code
CR
hc_renew_date Health Card Renewal
2006-01-23
chartno User provided Chart No
eg the paper chart #
29973
phone home phone
705-647-4399
phone2 work phone
705-647-4399
cell cell phone
705-647-4399
phone_extension extension
23
phone2_extension extension
23
age Current age in years
74
age_in_months Current age in months
14
ageComplex Age expressed in days weeks or months for infants and toddlers and years  for older children or adults
74 year old
sex gender
M
sin
Social Security Number
111-222-333
medical_history history
1984 ANTEROLATERAL MYOCARDIAL INFARCT
2000 COPD
2001 ATYPICAL PNEUMONIA
2007 OSTEOPENIA
2009 CATARACT REMOVAL & IOL IMPLANT(Right)
2016 CVA (CEREBROVASCULAR)(Right)
other_medications_history Comma delineated list of family history and other meds
dad renal failure 76 IHD, mom AMI 75 NIDDM
social_family_history Comma delineated list of social history
Lives with son Michael, Retired
ongoingconcerns Comma delineated list of ongoing concerns
Limited finances
reminders Comma delineated list of reminders
Findlay's, If unable to reach patient at home tel #, contact Mike (caretaker) at 705-676-7995(cell).
risk_factors_json Risk Factors from CPP [{"note":"risky gambling"}]
family_history_json Family History from CPP [{"note":"Father cardiomyopathy 32 passed out\nuncle died of brain tumour 1.5yo"}]
dxregistry Comma delineated disease registry items
ESSENTIAL HYPERTENSION*, CHRONIC BRONCHITIS*
OHIPdxCode Comma delimited OHIP diagnosis codes billed
715,919,300,366,896,401,610,381,799,380,493,388,491,454,386,691,780
allergies_des Comma delineated allergies and
archived (deleted)
PENICILLIN
archived allergies: AMOXIL
allergies_des_no_archived Comma delineated current allergies
PENICILLIN
recent_rx recent Rx
2015-11-12 AGGRENOX Take 1 Tabs PO BID for 90 Days LU Code: 349 Qty:180 Repeats:3
2015-11-08 MUCOMYST INJ 200MG/ML 2 ml by nebuliser TID for 30 days Qty:90 ml Repeats:4
2015-10-31 PULMICORT NEBUAMP 0.5 MG/ML inhale contents of 1 nebule BID for 60 days LU Code: 264 Qty:120 Repeats:0
SALBUTAMOL  1MG LIQUID Take 1 neb qid for 90 days Qty:360 Repeats:3
IPRATROPIUM BROMIDE .25MG SOLUTION 1 neb Q6H for 90 days Qty:360 Repeats:3
SALBUTAMOL  100MCG METERED-DOSE AEROSOL 1-2puff QID INH PRN for 30 days Qty:2 Repeats:12
today_rx todays Rx
2015-11-12 AGGRENOX Take 1 Tabs PO BID for 90 Days LU Code: 349 Qty:180 Repeats:3
druglist_generic Generic drug list one per line
ACETYLSALICYLIC ACID 25.0 MG DIPYRIDAMOLE 200.0 MG 1 BID
ACETYLCYSTEINE 0 TID
SALBUTAMOL (SALBUTAMOL SULFATE) 0 QID prn
IPRATROPIUM BROMIDE 0 Q6H
SALBUTAMOL (SALBUTAMOL SULFATE) 1 qid
BETAHISTINE HYDROCHLORIDE 16.0 MG 1 TID
FUROSEMIDE 20.0 MG 1 OD
druglist_trade Trade drug list one per line
AGGRENOX 1 BID
MUCOMYST INJ 200MG/ML 0 TID
VENTOLIN  100MCG METERED-DOSE AEROSOL 0 QID prn
ATROVENT .25MG SOLUTION 0 Q6H
VENTOLIN  1MG LIQUID 1 qid
NOVO-BETAHISTINE 16MG 1 TID
LASIX 20 TAB 1 OD
druglist_line the shortest druglist mixed case comma delineated
Aggrenox 1 BID, Mucomyst inj 200mg/ml 0 TID, Salbutamol  100mcg metered-dose aerosol 0 QID prn, Ipratropium bromide .25mg solution 0 Q6H, Salbutamol  1mg liquid 1 qid, Novo-betahistine 16mg 1 TID, Furosemide 20 tab 1 OD
onGTPAL Ontario Antenatal Record GTPAL code
GxTxPxAxLx
onEDB
Ontario Antenatal Record EDB
2016-12-31
bcGTPAL
British Columbia Antenatal Record GTPAL code
GxTxPxAxLx
bcEDD British Columbia Antenatal Record EDD
2016-12-31
doctor Last, First of doctor listed by Oscar in demographics
Hutten-Czapski, Peter
doctor_provider_no Provider number
1007
doctor_ohip_no Their billing number
150692
doctor_specialty_code Their specialty
00
doctor_cpsid Their CPSID
54345
doctor_title Their Title
MD (this column is in the database but not editable)
provider_name Last, First
Hutten-Czapski, Peter
provider_name_first_init Name
P. Hutten-Czapski
doctor_work_phone work no from the provider table
705-672-1111
doctor_signature Their signature from provider preferences
MD
appt_provider_name The provider listed for the appointment
Hutten-Czapski, Peter
appt_provider_id The provider's id listed for the appointment
101
appt_no The appointment no
353104
referral_name Last, First
SPADE, SAM
(These come from the ProfessionalSpecialists table using the ReferralNo)
referral_address Multiline address
431 Whitewood Ave
New Liskeard ON P0J 1P0
referral_phone Referral phone
(705) 647-1112 Ext 5422
referral_fax Fax no
705-647-1234
bc_referral_name
Last, First
SPADE, SAM
(These come from the billingreferral table using the ReferralNo)
bc_referral_address Multiline address
431 Whitewood Ave
New Liskeard ON P0J 1P0
bc_referral_phone Referral phone
(604) 647-1112 Ext 5422
bc_referral_fax
Fax no
604-647-1234
bc_referral_no Referring MD no
666666
clinic_name name
Haileybury Family Health Team
clinic_phone As per admin
705-672-1111
clinic_fax As per admin
705-672-2222
clinic_label Multiline name and address
Haileybury Family Health Team
2913 Meridian
Haileybury,Ontario,P0J 1P0
Tel:672-1111Fax:705-672-2222
clinic_addressLine Street
2913 Meridian
clinic_addressLineFull Street, City, Province, Postal
2913 Meridian, Haileybury, Ontario, P0J 1K0
clinic_address Multiline
Note bug in where the P0J 1K0 goes
2913 Meridian
Haileybury,P0J 1P0
Ontario,Canada
clinic_city city Haileybury
clinic_province province
Ontario
clinic_postal postal
P0J 1K0
dtap_immunization_date dtap immunisation date
2012-11-19
flu_immunization_date flu shot date
2013-11-19
fobt_immunization_date fobt date
2014-11-19
mammogram_immunization_date mammo date
2014-11-19
pap_immunization_date pap date
2015-11-19
cytology_no
cytology number
number (from demographicExt table where key = 'cytolNum')
guardian_label from new relationships tables
first last
address
city province
postal

MIKE MACDONALD
431 Whitewood Ave
New Liskeard ON
P0J 1P0
guardian_label2 Substitute Decision Maker
first last
address
city province
postal
MIKE MACDONALD
431 Whitewood Ave
New Liskeard ON
P0J 1P0
email patient email
my.name@oscarcanada.org
urine_tox_test_json Measurements OPID MAMP BZD CANB Uetc
[{"type":"BZD","dataField":"pos","comments":"","dateObserved":"2016-04-04 00:00:00.0","dateEntered":"2016-04-04 12:34:46.0"},{"type":"MAMP","dataField":"neg","comments":"","dateObserved":"2016-04-04 00:00:00.0","dateEntered":"2016-04-04 12:34:46.0"}]
methadone_induction_assessment_json Measurements RHU ORDU MDD GWS
[{"type":"RHU","dataField":"Yes","comments":"","dateObserved":"2016-04-04 00:00:00.0","dateEntered":"2016-04-04 12:34:46.0"}]

Using JSON tags

The JSON tags give results in JavaScript Object Notation that allows for arrays of data to be passed.  These strings are typically parsed by a programming language into an array of data.  The following example uses javascript to manipulate the data and present it on the form

<script>
function runJSON(){
   var text ='{note:'+document.getElementById("urine_tox_test_json").value+'}';
   obj = JSON.parse(text);
   document.getElementById("demo").innerHTML = obj.data[1].type+"="+obj.data[1].dataField  ;
}
</script>
</head>
<body onload="runJSON()">
<form method="post" action="" name="FormName" id="FormName" >
<p id="demo"></p>
<input id=""urine_tox_test_json" type="hidden"  oscarDB=urine_tox_test_json>

with the data from the tag example table above would display the paragraph element with id of demo with

MAMP=neg

The following eform tags are not directly accessible and are used in some invoice functions

service_date billing date

practitioner billing provider
ref_doctor billing referring id
fee_total Invoice total 0.00
payment_total Payment total
0.00
refund_total Refund total
0.00
balance_owing
balance
0.00
bill_item_number billing item

bill_item_description billing description

bill_item_service_code billing service code

bill_item_qty billing quantity

bill_item_dx billing diagnosis

bill_item_amount billing item amount

Enhanced Updatable Database Tags

These oscarDB's (as with measurements) can both read and push to update the database. To allow a field to be updated in the database, the <databaseap> tag
(in resources/oscar/eform/apconfig.xml) for each field must include an <ap-insql> tag with an UPDATE sql statement.

For Oscar 15 the following fields are so enabled:  patient_nameL, patient_nameF, patient_alias

The <ap-insql> tag allows: ${value} (value of the entered field),${demographic} (demographic number), ${provider} (provider number), and ${fid} (eform id).

In the eform, the <input> tag that you want to be able to update must include an oscarDBinput attribute, like this:

<input type="text" name="test" oscarDB=patient_nameL oscarDBinput>

Users must check the "Update fields in database" checkbox on the eform in order to update the fields on the form in the database.  Otherwise, they'll just be saved as part of the eform; the <ap-insql> query won't be executed.

Users can click on the "Refresh DB Fields" button to update all of the <input> tags with an oscarDB attribute with the most recently available data from the database.

All updates are recorded in the security log as a DatabaseAP "edit" action, which includes the query that was executed.

Extended database tags

These oscarDBs cannot be directly called (i.e. oscarDB=<tag>). They should be called in special formats so as to include extra parameters.

oscarOPEN="formname"

This will allow to open another eForm by name.  The following will open the eForm 'test':

<input type="button" name="a_name_is_required" oscarOPEN="test" />

 

oscarDB=e$first#{var_name}

Parameter: {var_name} = (name of eform field)
Description:
This ap retrieves the value of field {var_name} from the same eform which is first submitted.
Only value of the same eform (same fid) is retrieved, therefore eforms using this ap must have a field {var_name}.
Deleted eform data (fdid status=0) is excluded.

For example if you want to retrieve the value of the first patient which is stored in the field "name" for whom a copy of the same  eForm is saved you would use:

oscarDB=e$first#name


oscarDB=e$last#{var_name}

Parameter: {var_name} = (name of eform field)
Description:
This ap retrieves the value of field {var_name} from the same eform which is last submitted
Only value of the same eform (same fid) is retrieved, therefore eforms using this ap must have a field {var_name}.
Deleted eform data (fdid status=0) is excluded.

For example to retrieve the value of field "resident" in the same eform which is last submitted

oscarDB=e$last#resident


oscarDB=e$count#{var_name}

Parameter: {var_name} = (name of eform field)
Description:
This ap counts the total number of non-empty field {var_name} in all the same eforms.
Only value of the same eform (same fid) is retrieved, therefore eforms using this ap must have a field {var_name}.
Deleted eform data (fdid status=0) is excluded.

For example to retrieve the total number of fields "bp" which are filled in all the same eforms

 oscarDB=e$count#bp


var$value={var_value}

Parameter: {var_value} = (value of eform field)
This ap works together with e$count to count the total number of field {var_name} which has the value {var_value} in all the same forms.
It has no effect when put together with e$first or e$last.

If {var_value} contains space, it must be quoted ("...").
{var_value} can be a static value or be dynamic, see *Dynamic var_value* for detail.

For example to count the total number of field "resident" which has the value "Cheng, Ronnie" in all the same eforms

oscarDB=e$count#resident var$value="Cheng, Ronnie"


ref${var_name}

Parameter: {var_name} = (name of eform field)
This ap works together with e$count to count the total number of a certain field in the same forms which contains another non-empty field {var_name}.
It has no effect when put together with e$first or e$last.

For example to count  the total number of field "resident" in all the same eforms which also have the field "observer" filled

oscarDB=e$count#resident ref$observer


ref${var_name}={var_value}

Parameter: {var_name} = (name of eform field)
    {var_value} = (value of eform field)
This ap works together with e$count to count the total number of a certain field in the same forms which contains another  field {var_name} with the value {var_value}.
It has no effect when put together with e$first or e$last.

If {var_value} contains space, it must be quoted ("...").
{var_value} can be a static value or be dynamic, see *Dynamic var_value* for detail.

For example to count the total number of field "resident" in all the same eforms which also have field "observer"="Cheng, Ronnie"

oscarDB=e$count#resident ref$observer="Cheng, Ronnie"


eform$name={eform_name}


Parameter: {eform_name} = (name of another eform)
This ap works together with all e$ to retrieve values from another eform instead of the eform in use.
NOTE: If more than one eforms have the same name, only the first one (smallest fid) is referenced.

For example to count the total number of field "resident" in all the "Teaching Field Note" eforms which also have the field "observer" filled)

oscarDB=e$count#resident ref$observer eform$name="Teaching Field Note"


oscarDB=o${table_name}#{other_id_name}


Parameter: {table_name} = appointment/patient
    {other_id_name} = (name of the alternative id)
Description:
This ap retrieves alternative id from the other_id table.
Other_id table stores alternative id for patient demographics and appointments. Mapping to more tables can be created in the future.
For patient demographics alternative id, this ap references the demographic no of the current eform.
For appointments alternative id, it references the appointment no parameter passed when calling eform from the appointment screen.
NOTE: Appointments alternative id won't work if calling eform from "Search demographic".

For example to retrieve an appointment alternative id named "mc_number"

oscarDB=o$appointment#mc_number

*Dynamic var_value*

var_value can be set to reference a field value in the eform. To use this, simply write a field name and surround it with a pair of brackets {}.
NOTE: The var_value reference is made once when the eform is loaded. Therefore the field being referenced must have an initial value (value=... or oscarDB=...). User input to the referenced field will NOT change the var_value.

Example to count the total number of field "patient" in all the same eforms which has the value of field "patient" in this eform

<input name="patient" type="text" oscarDB=patient_name>
<input name="total_encounter" type="text" oscarDB=e$count#patient var$value={patient}>

 

Summary Template

Summary templates are defined in an eform to write a summary of the eform content into Oscar message, edoc or echart when the eform is submitted.

The template must be placed in comment <!-- ... -->

Special value tags are used to extract field values from eform.

Template format:

<!--
<template>
    <document belong=provider|patient>
        <docdesc>{document description}</docdesc>
        <docowner>{document owner}</docowner>
        <content>{content}</content>
    </document>

    <message>
        <subject>{subject}</subject>
        <sendto>{recipient1,recipient2,...}</sendto>
        <content>{content}</content>
    </message>

    <encounternote>{content}</encounternote>
    <socialhistory>{content}</socialhistory>
    <familyhistory>{content}</familyhistory>
    <medicalhistory>{content}</medicalhistory>
    <ongoingconcerns>{content}</ongoingconcerns>
    <riskfactors>{content}</riskfactors>
    <reminders>{content}</reminders>
    <othermeds>{content}</othermeds>
</template>
-->

Description:

Document template has a "belong=" attribute. If belong=provider, it is written as a provider document. If belong=patient, it is written as a patient document. The default is belong=provider.

The <docowner> entry must be a number. It is a provider_no/demographic_no. The default is the eform form_provider/demographic_no.

Message template <sendto> entry (ie recipient) must be one or more provider_no. There is no default to this entry.


For all the echart templates (<encounternote>, <socialhistory>, etc.), a link to the eform is added to the echart alongside the summary.

 

Value tags:

Value tags can be used anywhere in the summary templates, as long as it suits the format requirements.

Value tags come in 2 types: $t{...} and $te{...}


$t{...}

Put a field name inside the bracket. The field value will be filled-in when eform is submitted.

If the field name does not exist in eform, the tag will be written as it is to the summary.


$te{...}

These are "eform attribute" tags. They can be one of the following:

$te{eform.name|eform.subject|eform.patient|eform.provider|eform.link|eform.html}

In place of $te{eform.html}, the complete html of the eform will be written, with the action statement removed.

In place of $te{eform.link}, a link to the eform will be written and the eform name will be shown.

NOTE: Tag $te{eform.link} does not work in message content. Also, it's not necessary in echart templates because a link will already be in place.


Example:

Eform "TESTING" source html:

 

<html>
<input type="text" name="resident" value="Cheng, Ronnie">
</html>
<!--
<template>
 <encounternote>
This is the eform $te{eform.link}, it belongs to resident $t{resident}.
 </encounternote>
</template>
-->


Summary:


This is the eform TESTING, it belongs to resident Cheng, Ronnie.

(*The word TESTING is a link to the eform)

 

 

Document Actions