Opal Episodes have an associated category. These categories are
implemented as subclasses of
opal.core.episodes.EpisodeCategory. This class is an Opal
DiscoverableFeature and thus inherits all of the core
The category of any episode can be accessed as the
.category property of any
An episode category must be initialized with an instance of an episode.
from opal.core.episodes import InpatientEpisode category = InpatientEpisode(episode)
This is the template used within the Patient Detail View to display information about episodes of this category.
A list of strings that are valid values for
Episode.stage for this category.
Predidcate function to determine whether an episode of this category is visible to a particular user.
The default implementation will return True unless
UserProfile.restricted_only is set to
True. (In which case this user should not see any elements which are visible 'by default' for
InpatientEpisode.episode_visible_to(episode, user) # -> True
Returns a list of stages for this category as strings.
InpatientEpisode(episode).get_stages() # -> ['Inpatient', 'Followup', 'Discharged']
Predicate function to determine whether a string is a valid stage for this category.
InpatientEpisode(episode).has_stage('Inpatient') # -> True
Predicate function to determine whether this episode is active.
The default implementation looks to see whether an end date has been set on the episode.
InpatientEpisode(Episode()).is_active() # -> True
EpisodeCategory.set_stage(stage, user, data)
Sets the stage on the episode. It gets passed the user, and the rest of the data that's been used to update the episode.
InpatientEpisode(episode).set_stage('Discharged', user, data_dict) # -> True
This is the default EpisodeCategory imlpementation - applications started with Opal's
scaffolding scripts will use this as the
It sets the detail template to