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://opensrp.io
Apache License 2.0
56 stars 59 forks source link

[OpenSRP 2] Refactor QuestionnaireViewModel.kt #2470

Closed f-odhiambo closed 1 year ago

f-odhiambo commented 1 year ago

Describe the Issue Refactor QuestionnaireViewModel.kt

File https://github.com/opensrp/fhircore/blob/main/android/quest/src/main/java/org/smartregister/fhircore/quest/ui/questionnaire/QuestionnaireViewModel.kt

This code has some failing Conditions as described in the following line of code

https://github.com/opensrp/fhircore/blob/main/android/quest/src/main/java/org/smartregister/fhircore/quest/ui/questionnaire/QuestionnaireViewModel.kt#L204

Context

  1. We need to underhand why we need to declare the resource type before performing the extraction. is it necessary? We may need to have better handling of how we parse data before extraction (Patient, Group, Encounter, ...)
  2. There are other code smells that may need to be looked into also in this class
  3. Resolve some of the open TODOs in the code too
pld commented 1 year ago

@f-odhiambo can you please make this issue more specific than "refactor"? Fine if we need multiple issues, eg maybe this is about resourceType and you can add detail on that, then each TODO can be it's own separate issue

dubdabasoduba commented 1 year ago

@f-odhiambo could we have a conversation on this change so it can be clearly documented? This class has been changed a lot I would like us to iron out its functionality before implementation.

ndegwamartin commented 1 year ago

For the TODOs I think those are straight forward, those present seem to be linked to issues that are already fixed/closed so might probably just be a matter of clean up by some one who has context (or in collaboration with) so might be possible to have those done under the same ticket - I think @maimoonak tagged those

For Part 1 (and 2) I think those are the ones that require discussion and can be split into a separate issue that has its own Acceptance Criteria since it requires application of certain rules based on the FHIR Standard and also domain logic for the extraction that we want to enforce

ekigamba commented 1 year ago

The three TODOs are related to closed issues most of which have been implemented. We might only need to review this https://github.com/opensrp/fhircore/issues/900. @maimoonak seems to have more context on the issue