We have designs for a Task Management feature. I will be implementing these over the next few months, with the direction of @michaelbontyes . Relevant previous discussions:
- O3 & CDS: A Way Forward for Implementing PlanDefinitions , ActivityDefinitions and CarePlans in OpenMRS with FHIR, especially @ibacher 's comment near the end
- Persistent patient notes or to-do list
I would like to design the data side and backend implementation strategy here.
FHIR Representation
I think these are the entities that are needed:
- System Tasks: the elements of the Task Library, like task templates, optionally with trigger conditions.
- Tasks: the actual to-do items.
- Sub-tasks: this is not part of the design but is part of the project I am undertaking.
I am not sure how to represent these things with respect to PlanDefinitions, CarePlans, ActivityDefinitions, and maybe Tasks.
I think it would make sense for a System Task to be a PlanDefinition.activity. Maybe there would just be a 1:1 relationship there, so each System Task is a PlanDefinition, and most of its content lives in a single element of PlanDefinition.activity?
@ibacher has expressed, in the thread I linked at the top, that task list items should not be represented as FHIR Tasks, but rather as activities associated with a CarePlan. Note that the CarePlan has changed radically from v4 to v5. I have trouble imagining how we could use the v5 CarePlan for this purpose, without relying heavily on Tasks.
A CarePlan does not contain reference to an ActivityDefinition, so it doesnât seem that an ActivityDefinition could be the thing that represents a task in the task list. An ActivityDefinition would rather be part of how a PlanDefinition defines its action to be taken when the planâs action is instantiated into a CarePlan action.
My inclination is then to represent each task as a CarePlan with a single activity, which in some cases will have a corresponding PlanDefinition with a single action. All the relevant information would be in CarePlan.activity[0].detail.
Does this all make sense, seem right?
Once we get some consensus on this, then we can discuss the database representation and implementation strategy.