Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

App crashing when dynamically setting the range for a date item #1759

Closed
KhumboLihonga opened this issue Dec 9, 2022 · 5 comments
Closed
Assignees

Comments

@KhumboLihonga
Copy link

Describe the bug
The use case is that when entering a patient's test date, the date range should be after the patient's birth date and also not a future date. When the former is applied and the date picker is tapped, the app crashes.

Component
SDC library

To Reproduce
N/A

Expected behavior
I expect the date picker to open with the range applied accordingly.

Screenshots
N/A

Smartphone (please complete the following information):

  • Device: Samsung A12
  • Android version: 11
  • Build number: RP1A.200720.012.A127FXXU4AUK1
  • Version: 30

Additional context
Here is the questionnaire I'm using to test this. Specifically, this line is what is causing the crash, "expression": "@Patient.birthDate". I've tried a number of ways to do this but can't seem to get it to work.

Here is the log:

E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.google.android.fhir.demo, PID: 23037
    org.hl7.fhir.r4.utils.FHIRLexer$FHIRLexerException: Error in ?? at 1, 1: Premature ExpressionNode termination at unexpected token "Patient"
        at org.hl7.fhir.r4.utils.FHIRLexer.error(FHIRLexer.java:145)
        at org.hl7.fhir.r4.utils.FHIRLexer.error(FHIRLexer.java:141)
        at org.hl7.fhir.r4.utils.FHIRPathEngine.parse(FHIRPathEngine.java:340)
        at org.hl7.fhir.r4.utils.FHIRPathEngine.parse(FHIRPathEngine.java:331)
        at org.hl7.fhir.r4.utils.FHIRPathEngine.evaluate(FHIRPathEngine.java:520)
        at com.google.android.fhir.datacapture.validation.ValidationUtilKt.valueOrCalculateValue(ValidationUtil.kt:32)
        at com.google.android.fhir.datacapture.validation.MinValueConstraintValidator.getMinValue$datacapture_debug(MinValueConstraintValidator.kt:50)
        at com.google.android.fhir.datacapture.views.QuestionnaireItemDatePickerViewHolderFactory$getQuestionnaireItemViewHolderDelegate$1.getCalenderConstraint(QuestionnaireItemDatePickerViewHolderFactory.kt:156)
        at com.google.android.fhir.datacapture.views.QuestionnaireItemDatePickerViewHolderFactory$getQuestionnaireItemViewHolderDelegate$1.createMaterialDatePicker(QuestionnaireItemDatePickerViewHolderFactory.kt:150)
        at com.google.android.fhir.datacapture.views.QuestionnaireItemDatePickerViewHolderFactory$getQuestionnaireItemViewHolderDelegate$1.init$lambda-3(QuestionnaireItemDatePickerViewHolderFactory.kt:78)
        at com.google.android.fhir.datacapture.views.QuestionnaireItemDatePickerViewHolderFactory$getQuestionnaireItemViewHolderDelegate$1.$r8$lambda$5UhY9wSdxD4KX8dzfdN4hNLY5vA(Unknown Source:0)
        at com.google.android.fhir.datacapture.views.QuestionnaireItemDatePickerViewHolderFactory$getQuestionnaireItemViewHolderDelegate$1$$ExternalSyntheticLambda0.onClick(Unknown Source:4)
        at android.view.View.performClick(View.java:7792)
        at android.view.View.performClickInternal(View.java:7769)
        at android.view.View.access$3800(View.java:910)
        at android.view.View$PerformClick.run(View.java:30218)
        at android.os.Handler.handleCallback(Handler.java:938)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loopOnce(Looper.java:226)
        at android.os.Looper.loop(Looper.java:313)
        at android.app.ActivityThread.main(ActivityThread.java:8669)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1135)

Would you like to work on the issue?
This can be a follow up to #1442

@jingtang10 jingtang10 self-assigned this Dec 11, 2022
@jingtang10
Copy link
Collaborator

Thanks for raising this @KhumboLihonga.

Unfortunately i don't think the sdc library supports this right now - we do try to evaluate FHIRPath expressions in the calculatedValue extension (with canonical url http://hl7.org/fhir/StructureDefinition/cqf-calculatedValue) but i think we might need to fix that (as that extension is clearly pointing to cql libs)

@brynrhodes can you help here please? what should the questionnaire be if we want to reference a patient's birthdate? should we use launch context?

fyi @maimoonak

@jingtang10
Copy link
Collaborator

also @costateixeira might be able to help

@Itskiprotich
Copy link
Contributor

@jingtang10 have been trying to simulate this issue and here is my approach. I have made an update to this questionnaire and here is my output from the demo app.

Screenshot_20230117_093904

@jingtang10
Copy link
Collaborator

I think this is now possible with launch context, variable expression and constraits.

@jingtang10
Copy link
Collaborator

This is obsolete and confirmed by Ager.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Complete
Development

No branches or pull requests

4 participants