HFE: <markPatientDead/> always marks the patient as deceased?

Hi

I took a look into the tag <markPatientDead>, to find if it was possible to make the submission “OPTIONAL”.

- Tag as Optional

For context, I´m currently working on a “Discharge” form, where it should be possible to select many options.

image

Being the one I´m currently working “Mark a patient as Deceased”.

Ideally, the tag will only mark the patient as deceased if selected.
Unfortunately, the will always mark the patient as decease no matter what.

I did some initial testing, using the tag <markPatientDead> in conjunction to the tag <controls>/<when>. With a bit of luck, it would not only hide it, but also avoid the submission. But this was not the case.

Tested in https://qa-refapp.openmrs.org/ by adding Cause of death - Conditions - Pastebin.com to the default form.

- CauseOfDeathFromObs problems

Wile doing this I also found something weird;

In the wiki it is mentioned that if “causeOfDeathFromObs” is not given, it will submit as “Unknown”.

This seem to not be the case and it will fail if a “causeOfDeathFromObs” is not given, the errors can be seen bellow:

image

Do you have any clue @mogoodrich

CC: @dkayiwa, @mksd

Thanks @icrc.thonorio … yes, I forget the history of this widget, but it looks like that is the expected behavior, to always mark a patient as dead, at least according to the documentation:

https://wiki.openmrs.org/display/docs/HTML+Form+Entry+Module+Reference#HTMLFormEntryModuleReference-<enrollInProgram>

It would seem to make sense to support a “showCheckbox” field on this tag, that operates similarly to how it does for the enrollInProgram tag:

https://wiki.openmrs.org/display/docs/HTML+Form+Entry+Module+Reference#HTMLFormEntryModuleReference-<enrollInProgram>

Would that serve your use case?

Alternatively, you could likely add a CustomFormSubmissionAction to do this based on the answer to an Obs on the form… unfortunately this functionality isn’t well-documented, but you can find information about it here (I just updated the javadoc/comments on it):

As for the causeOfDeathFromObs issue, assuming you have confirmed that the global property “concept.unknown” is set on the system you are testing on, that sounds like a bug and worth filing.

Thanks!

Take care, Mark

Hi @mogoodrich

At first glance, an option just like “showCheckbox” would do the trick

Great. Can you create a ticket for this in the HTML module?

There isn’t anyone actively working on open ticket requests for the module, but I’m happy to code review if you or anyone working with you has time to work on it.

Take care, Mark