We’re currently working on developing the InPatient Module in Bahmni. This module enables nurses, doctors, and other staff members to carry out various tasks for patients/wards during their admission period.
For instance, upon admission, a nurse needs to conduct an initial assessment of the patient.
To implement these functionalities, we intend to leverage our existing FHIR Task domain model. However, we’ve identified the need for some additions to our current OpenMRS fhir_task entity models to accommodate all of our task use cases.
Additional Columns
Datatype
Nullable
Comments
code
int
Y
To determine what is type of task
restriction_period_start_time
datetime
Y
restriction_period_end_time
datetime
Y
To determine when the fulfillment of the task is sought
execution_start_time
datetime
Y
execution_end_time
datetime
Y
To determine when the task was actually done
And a new join table to accommodate grouping of tasks fhir_part_of_reference
Columns
Datatype
Nullable
Comments
task_id
int
N
Reference to original task
reference_id
int
N
Reference to parent task which it belongs to
Kindly let us know for any concerns if any ! We’ll keep here posted on updates !
Also , would it be possible to patch this change in lower release versions of fhir (ie 1.10 version as well)
Do you need another table “fhir_part_of_reference”? why not use the existing “task reference” table itself?
whats the value of the additional task_id? if you are thinking of composite task, then this can be easily accommodated by adding a “parent_task_id” in the task table itself.
Do you need “restriction_period_end_time”? is your concern is that R4 does not have “task.requestedPeriod” (introduced in R5)? task.restriction.period has a slightly different semantic meaning - would like to hear what others think. I am assuming through this - you want to track whats the requested period when the task was created / or during assignment.
On these 2 points , there is a existing table task_based_on_reference , where we store the reference of based_on information. Not sure if this the right place to store the part_of info as well !
Also on the 3rd point on , the idea to create to new table fhir_part_of_reference instead of accommodating in the same table is , coz of thought we had that a task can have two parent tasks.
For instance ,
Task: “Bring patients for endoscopy tomorrow”
Task: “Take Fasting blood sugar tomorrow”
For both of these parent tasks, a subtask involves informing the nurse to advise the patient to refrain from eating or drinking labeled as “Nothing by Mouth” task.
While it’s still feasible to achieve this by creating separate entries in the existing table with a parent_task_id field, would like to hear which approach would be a better fit here !
We are currently operating with OpenMRS version 2.5.12 and FHIR2 version 1.10.x. So to upgrade fhir version, we would need upgrade of openmrs versions as well .
Though we have started analysing on adopting to that ,that would still need some more time for us, to be in position of upgrading openmrs versions , so this patch will help in supporting this in existing versions as well !
thanks @ibacher ! Yeap we tried earlier ! and we ended up having class not found issue at first glance !
We ll try to deep dive into this issue now & see if it gets resolved !
any insights on this error will be helpful !
Unable to start OpenMRS. Error thrown was: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘fhirConceptSourceCsvParser’: Lookup method resolution failed; nested exception is java.lang.IllegalStateException: Failed to introspect Class [org.openmrs.module.initializer.api.fhir.cs.FhirConceptSourceCsvParser] from ClassLoader [{ModuleClassLoader: uid=1433522909; initializer}]
org.openmrs.module.ModuleException: Unable to start OpenMRS. Error thrown was: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘fhirConceptSourceCsvParser’: Lookup method resolution failed; nested exception is java.lang.IllegalStateException: Failed to introspect Class [org.openmrs.module.initializer.api.fhir.cs.FhirConceptSourceCsvParser] from ClassLoader [{ModuleClassLoader: uid=1433522909; initializer}]
at org.openmrs.web.WebDaemon.startOpenmrs(WebDaemon.java:69)
at org.openmrs.web.Listener.contextInitialized(Listener.java:243)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4492)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:4950)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:711)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:688)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:661)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1016)
at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1903)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:750)
Caused by: javax.servlet.ServletException: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘fhirConceptSourceCsvParser’: Lookup method resolution failed; nested exception is java.lang.IllegalStateException: Failed to introspect Class [org.openmrs.module.initializer.api.fhir.cs.FhirConceptSourceCsvParser] from ClassLoader [{ModuleClassLoader: uid=1433522909; initializer}]
at org.openmrs.web.Listener.startOpenmrs(Listener.java:315)
at org.openmrs.web.WebDaemon$1.run(WebDaemon.java:42)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘fhirConceptSourceCsvParser’: Lookup method resolution failed; nested exception is java.lang.IllegalStateException: Failed to introspect Class [org.openmrs.module.initializer.api.fhir.cs.FhirConceptSourceCsvParser] from ClassLoader [{ModuleClassLoader: uid=1433522909; initializer}]
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.determineCandidateConstructors(AutowiredAnnotationBeanPostProcessor.java:289)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:551)
at org.openmrs.module.ModuleUtil.refreshApplicationContext(ModuleUtil.java:885)
at org.openmrs.module.web.WebModuleUtil.refreshWAC(WebModuleUtil.java:844)
at org.openmrs.web.Listener.performWebStartOfModules(Listener.java:661)
at org.openmrs.web.Listener.performWebStartOfModules(Listener.java:641)
at org.openmrs.web.Listener.startOpenmrs(Listener.java:307)
… 1 more
Caused by: java.lang.IllegalStateException: Failed to introspect Class [org.openmrs.module.initializer.api.fhir.cs.FhirConceptSourceCsvParser] from ClassLoader
… 17 more
Caused by: java.lang.NoClassDefFoundError: org/openmrs/module/fhir2/model/FhirConceptSource
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2729)
at java.lang.Class.getDeclaredMethods(Class.java:2003)
at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:463)
… 19 more
Caused by: java.lang.ClassNotFoundException: org.openmrs.module.fhir2.model.FhirConceptSource
I think the overall design here makes sense. I agree with @angshuonline’s point that if the idea is the model requested period, we probably need something else, likely just mapping to a custom extension and the corresponding requested_period_start_time and requested_period_end_time in the database. Restriction period is meant to communicate “this task can only be performed within this time frame”.
And, yeah, don’t use the task_based_on_reference table for partOf. The idea was to support the 0..n relationships with a single table for all references.