Home » JavaScript Validation
The JavaScript engine allows you to create custom validation rules, which will be used during the conformance validation of your HL7 messages.
You can add custom javascript validation rules at the profile, trigger-event, segment and data-type levels. The javascript rules will be evaluated during the HL7 message validation, depending on the element of the message being validated.
Profile: Validation rules added at the Profile level will be evaluated first and only once per message.
Trigger-Event: Validation rules added at the Trigger-Event level will be evaluated only once per message and will only be evaluated for matching messages. The MSH.9 – Message Type is used to match messages and trigger-events.
Segment: Validation rules added at the Segment level will be evaluated for each instances of the segment in a message.
Data-Type: Validation rules added at the Data-Type level will be evaluated for each instances of the data-type in a message.
During HL7 message validation, the JavaScript engine context is updated, allowing you to access the current element being validated. The context has the following properties you can refer to:
The profile object allows you to fetch data from profile.
var administrativeSexTable = profile.getTable('0001');
log('Table : ' + administrativeSexTable.Name);
// Table : Administrative Sex
The table object allows you to get details about a given table in a profile.
var administrativeSexTable = profile.getTable('0001');
log('Name: ' + administrativeSexTable.name);
// Name: Administrative Sex
var administrativeSexTable = profile.getTable('0001');
log('First Value: ' + administrativeSexTable.values[0]);
log('Second Value: ' + administrativeSexTable.values[1]);
// First value: A
// Second value: F
var administrativeSexTable = profile.getTable('0001');
log('Contains M: ' + administrativeSexTable.contains('M'));
// Contains M: true
var administrativeSexTable = profile.getTable('0001');
var maleEntry = administrativeSexTable.get('M');
log('Male Entry: ' + maleEntry);
// Male Entry: M
The TableEntry object allows you to get the details of a table entry.
var maleEntry = administrativeSexTable.get('M');
log('Label: ' + maleEntry.label);
// Label: Male
var maleEntry = administrativeSexTable.get('M');
log('Value: ' + maleEntry.value);
// Value: M
var maleEntry = administrativeSexTable.get('M');
log('Deprecated : ' + maleEntry.getExtraContentValue('DEPRECATED'));
// Deprecated : false
var maleEntry = administrativeSexTable.get('M');
log('ToString: ' + maleEntry.toString());
// ToString: M
NORTH AMERICA: +1 (877)-872-0027
WORLD: 1-418-872-4000
EMAIL: info@caristix.com
ASIA-PACIFIC
DENIS CANTIN
T: +61418441388
denis.cantin@caristix.com
NORTH AMERICA & EUROPE
JEAN-LUC MORIN
T: 418 872-4000
jeanluc.morin@caristix.com
HL7® / FHIR® are a registered trademarks of Health Level Seven International. The use of this trademark does not constitute an endorsement by HL7.