google / android-fhir

The Android FHIR SDK is a set of Kotlin libraries for building offline-capable, mobile-first healthcare applications using the HL7® FHIR® standard on Android.
https://google.github.io/android-fhir/
Apache License 2.0
465 stars 246 forks source link

Questionnaire Constraint support #2003

Closed FikriMilano closed 4 months ago

FikriMilano commented 1 year ago

Is your feature request related to a problem? Please describe. Do custom validation for a given questionnaire.item with a FHIRPath custom predicate and custom error message.

Use case: There is a vaccination date field, and we want to make sure that when the user inputs a date. The date must not be before the Patient's DOB.

What should happen: If the user inputs a date that's before the Patient's DOB. Then show a custom error message below the field: “Date must not be before the DoB”.

Describe the solution you'd like Add support for Questionnaire Constraint extension to do this.

Describe alternatives you've considered N/A

Additional context

Would you like to work on the issue? N/A

FikriMilano commented 1 year ago

@jingtang10 @f-odhiambo @pld @samkanga

FikriMilano commented 9 months ago

another use case is: enter phone number field confirm phone number field

if the 2 values are different, then show validation error

cc @mmweru

FikriMilano commented 9 months ago

@jingtang10 it has been finalized that I'm working on this

FikriMilano commented 8 months ago

@shelaghm Should we use the pop-up dialog that displays a list of errors to show a global level error message from this constraint-extension to the user? What do you suggest?

Screen Shot 2023-10-20 at 13 31 38
pld commented 8 months ago

if we go w/that, is there a setting to disable the "submit anyway" button? there are projects that would not want to have that option available

FikriMilano commented 8 months ago

@pld the visibility of "submit anyway" button is not configurable. We can discuss to make it configurable, @jingtang10 @santosh-pingle

A question: Do we have a use case to not use the error dialog itself? or are we ok for that dialog to start showing up in OpenSRP 2? My concern is, our SDK snapshot release should have the latest code on master. So, this dialog should now popping up on our OpenSRP 2 if there are validation errors. This is regardless of what causes the validation errors i.e. it could be from required field or others, so it's not only from this constraint extension.

jingtang10 commented 4 months ago

Closing this in favour of #1849 which was opened first.

jingtang10 commented 4 months ago

if we go w/that, is there a setting to disable the "submit anyway" button? there are projects that would not want to have that option available

@pld we don't have this as a customized option at the moment. but as @FikriMilano said we might be able to add this. i'll create an issue for this.