Reference Service
Overview
The reference service provides a mechanism for documenting the available field values in both the internal MPage Developer services and your custom CCL scripts. On its own, the reference service does not provide any functionality, however, the reference data retrieved with it can be used in MPages where you want to offer user selectable dynamic field choices.
The reference service will be an integral part of Clinical Office: MPage Designer as it will be used to generate field select lists to allow users the ability to design their MPages.
Import
import {Component, inject, OnInit, ...etc...} from '@angular/core';
import {ReferenceService} from '@clinicaloffice/mpage-developer';
Object Assignment
Using the Angular inject command, assign the ReferenceService to a new object. It is recommended that you scope your object as "protected" to allow access to your component HTML.
@Component({...
...})
export class YourComponent implements OnInit {
protected referenceService = inject(ReferenceService);
....remaining code...
Data Collection
The examples below demonstrate data collection methods you can use.
// Load the reference data for all built in MPage Developer services
this.referenceService.loadCoreReference();
// Use the Custom Service to load custom script reference. Reference values will be associated to the id name.
this.customService.load({
reference: true,
customScript: {
script: [
{ name: '1co5_mpage_template:group1', run: 'pre', id: 'custom_test' }
]
}
});
Payload Options
The reference service payload uses the same payload options you would normally use for any other service if you were collecting data for that service. The key to indicate if reference data is to be collected is the reference: true object property.
{
"payload": {
"patientSource": [{"personId": 0, "encntrId": 0}],
"reference": true,
"address": true,
"allergy": true,
"diagnosis": true,
"encounter": true,
"organization": true,
"person": true,
"phone": true,
"prsnl": true,
"problem": true
}
}
Using Callbacks
Both the service load method and MPageService executeCCL methods offer a callback parameter as the final parameter. You can use this callback or another option of your choosing to work with the data returned from Cerner.
this.MPageService.executeCCL({
payload: {
...
}
}, () => { ...do something here... }
Methods / Usable Objects
clear(personId: number): voidClears problems from memory for a specific personId. If 0 is passed as the personId, all problems for all patients are removed from memory.
get(keyName: string): IReferenceIf loaded, the get method will return an IReference record for the specified keyName value.
e.g. referenceService.get('Allergy');
has(personId: number): booleanDetermines if the personnel record has been loaded for a specific personId value.
keys(): IterableIterator<any>Returns an iterable iterator representation of all loaded reference keys.
length(): numberReturns a count containing the number of reference service values loaded in memory.
loadCoreReference(): voidLoads reference information for all MPage Developer built in services (e.g. Address, Allergy, Diagnosis, etc.)
putLog(text: string, type: string = 'info', processId: number = -1, statusText: string = ''): voidWrite a line of text to the MPage Developer log. Valid values for type include 'info', 'error', 'payload', and 'debug'. You should only use the values 'info' or 'error' as 'payload' and 'debug' are reserved for system use. The processId and statusText values can safely be ignored.
reference(): Map<string, IReference[]>Direct reference to the reference Map object.
references(): string[]>Array listing key names in the reference Map object.
e.g. [ "Address", "Allergy", "Diagnosis", "Encounter", "Organization", "Person", "Phone", "Problem", "Prsnl" ]
values(): IterableIterator<any>Returns an iterable iterator representation of all loaded reference values.
Interfaces
IReference {
fieldName: string;
fieldType: string;
codeSet?: number;
codeSetDescription?: string;
children?: IReference[];
}