opensrp / fhircore

FHIR Core / OpenSRP 2 is a Kotlin application for delivering offline-capable, mobile-first healthcare project implementations from local community to national and international scale using FHIR and WHO Smart Guidelines on Android.
https://smartregister.org
Apache License 2.0
54 stars 41 forks source link

Quest v0.2 / G6PD: Sub-Task - Add validation before posting a registration questionnaire #616

Closed f-odhiambo closed 2 years ago

f-odhiambo commented 2 years ago

Acceptance criteria

NB. This is a good candidate to also test validation of required fields based on the SDC library. This ticket will be used to track the FHIRCore implementation

owais-vd commented 2 years ago

@f-odhiambo I thought the validation could be based on questionnaire specification and apply all types of form.

f-odhiambo commented 2 years ago

@f-odhiambo I thought the validation could be based on questionnaire specification and apply all types of form.

This is accurate. This ticket is to track that implemention once SDK implemention is ready

pld commented 2 years ago

Cool, it's possible this'll be baked into the SDC and all we need to do to close this issue is verify that's functioning as expected

pld commented 2 years ago

I think the latest SDK release should include this

maimoonak commented 2 years ago

SDK ticket related to this is https://github.com/google/android-fhir/issues/577

pld commented 2 years ago

Sounds like we need to implement our own validation in FHIR Core in the mean time, doesn't look like anyone's working on that broader issue

maimoonak commented 2 years ago

Jing shared the link to QuestionnaireResponseValidator in SDK and mentioned that this might be the functionality we are looking for but also mentioned that there might be a bug in this class where link-id may not be working properly. Going through the class looks like we can use this for our purpose however, I need to test and explore it further.

maimoonak commented 2 years ago
pld commented 2 years ago

Instead of showing a popup, can we disable the "Save" button until validation passes?

maimoonak commented 2 years ago

Actually the validation triggers on clicking save button. I did not find anything triggering validate in QuestionnaireFragment which keep a global status updated. Let me confirm it again but problem is we do have control over widgets in form.

pld commented 2 years ago

OK I see, so in that case, would we need an SDK change allow us to tie handlers to the QuestionnaireFragment?

If that's so, let's open the issue on the SDK, and go with this approach for now.

maimoonak commented 2 years ago

I checked this validation looks like is under progress on SDK and one of the variable which tracks state of widgets is 'internal' i.e. not accessible to external projects. Have dropped a message to Jing as well and once he responds would create ticket on SDK

pld commented 2 years ago

Cool, thanks for looking into this, current approach sounds good for what we can do now