Platform Version: 1.11.4
OpenMRS Version: 2.3
HTML Form Entry Version: 2.6
Question:
I have a hospital discharge form, which asks the outcome. If the outcome is that the patient died, I show additional fields (via JavaScript) to collect the cause of death. I would also like it to in this case, which is also hidden/shown via JavaScript. tries to mark the patient as dead in all situations; like it would be a death form rather than a generic discharge form. I get an error if I try to use it without specifying a cause of death.
Caused by: org.openmrs.api.ValidationException: 'Patient#14' failed to validate with reason: causeOfDeath: Cause of Death is required for people marked as deceased.
Is there a way to make it ignore marking the patient as dead if a cause isnât specified. Or is there a way that I can not allow the tag to execute based on input from the previous field on the form? I would try putting it in a but I have issues with that too⊠RA-932
@arbaughj, in what case are you seeing the error above? It seems like, according to the documentation, it should set the cause of death to unknown if you donât specify a reason.
But, regardless, I donât think this is your main issue regardless, correct? You want to conditionally mark a patient as dead based on an answer to a previous question? No immediate hacks come to mind to make this work out of the box, though the âcorrectâ functionality, I think, would be to add an attribute to the âmarkPatientDeadâ that tells the form instead of alway marking the patient dead, render a checkbox and only mark the patient dead if the checkbox is checked. Then you could potentially auto-set this checkbox based on dispostion.
Yes, @mogoodrich, that is exactly what Iâm trying to accomplish!
It seemed intuitive to me that if the causeOfDeathFromObs attribute wasnât set, that the patient hasnât really died, but I understand and agree with what youâre saying that it should be set as âUNKNOWNâ. FYI: the concept.unknown global property mentioned in the documentation doesnât exist out of the box. concept.otherNonCoded exists.
Showing a check-box would work, but thatâs more similar to the âexitFromCareâ tag which has a visible component. It seems markPatientDead should be used behind the scenes without direct user interaction.
Perhaps we could optionally add a parameter to specify the ID and value of another obs tag thatâs on the form. For example, âdoIfIdâ and âdoIfValueâ. Or, perhaps we could give the tag an ID attribute that could be controlled via JavaScript. Or perhaps we could somehow make it work with the toggle attribute if the tag was in the toggle. Of course we would have to fixâŠ
âŠto get that working.
Anyway you look at it, you and others are the experts, I just know what I need on the field.