google / fhir-app-examples

Contains examples of how Open Health Stack components can be used together as the foundation for FHIR based digital health solutions
https://developers.google.com/open-health-stack
Apache License 2.0
50 stars 26 forks source link

Update SDC and needed changes #17

Closed williamito closed 1 year ago

williamito commented 1 year ago

I'm not sure about the change to AddPatientViewModel.kt - is it != Valid the correct new comparison?

williamito commented 1 year ago

Thanks @omarismail94 . Creating new patients works now. If you try to edit a patient, the app crashes due to the questionnaire. I'll avoid edit patient while updating the documentation, but it would be great if we can fix it.

FATAL EXCEPTION: main
Process: com.google.fhir.examples.demo, PID: 13579
java.lang.IllegalStateException: QuestionnaireItem item is not allowed to have both initial.value and initial expression. See rule at http://build.fhir.org/ig/HL7/sdc/expressions.html#initialExpression.
    at com.google.android.fhir.datacapture.mapping.ResourceMapper.populateInitialValue(ResourceMapper.kt:247)
    at com.google.android.fhir.datacapture.mapping.ResourceMapper.populateInitialValues(ResourceMapper.kt:240)
    at com.google.android.fhir.datacapture.mapping.ResourceMapper.populateInitialValue(ResourceMapper.kt:269)
    at com.google.android.fhir.datacapture.mapping.ResourceMapper.populateInitialValues(ResourceMapper.kt:240)
    at com.google.android.fhir.datacapture.mapping.ResourceMapper.populate(ResourceMapper.kt:230)
    at com.google.fhir.examples.demo.EditPatientViewModel.prepareEditPatient(EditPatientViewModel.kt:55)
    at com.google.fhir.examples.demo.EditPatientViewModel.access$prepareEditPatient(EditPatientViewModel.kt:39)
    at com.google.fhir.examples.demo.EditPatientViewModel$prepareEditPatient$1.invokeSuspend(Unknown Source:14)
    at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
    at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
    at android.os.Handler.handleCallback(Handler.java:938)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:223)
    at android.app.ActivityThread.main(ActivityThread.java:7656)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
    Suppressed: kotlinx.coroutines.DiagnosticCoroutineContextException: [StandaloneCoroutine{Cancelling}@a822d0e, Dispatchers.Main.immediate]
omarismail94 commented 1 year ago

@williamito can you re-pull and try again? I updated the JSON file loaded to avoid the error that you were receiving

williamito commented 1 year ago

Thanks, that did fix the error! Those fixes should be enough for this PR, will follow up on any other errors separately.

omarismail94 commented 1 year ago

Thanks @williamito ! Merged!