The Episode service
Episode service in
opal.services provides us with core functionality related
to interacting with episodes in the client.
The Episode service is instantiated with the Episode data that comes back from the Episode JSON API.
var episode = new Episode(json_data);
Return a list of the current tags this episode has as strings.
episode.getTags(); // ['mine', 'infectioncontrol']
Return a human readable version of the Patient name suitable for rendering.
episode.getFullName() // -> 'Jane Doe'
Predicate function that determines whether the episode is tagged with a given tag.
tag: The tag you are interested in.
Instantiate a new subrecord for this episode of a given type.
recordName: The name of the type of record you want to instantiate.
episode.newItem('diagnosis'); // item (an Item() instance.
Takes a string, opens a modal from which the user can create a new subrecord of type
episode.recordEditor.newItem('diagnosis'): // -> Opens a modal with the diagnosis form and will create a new diagnosis on save
Open a modal from which the user may edit the
index-th item of type
episode.recordEditor.editItem('diagnosis', 0); // -> Opens a modal that allows the user to edit the first diagnosis