StanfordBDHG / ResearchKitOnFHIR

HL7 FHIR Structured Data Capture with ResearchKit on iOS
https://swiftpackageindex.com/StanfordBDHG/ResearchKitOnFHIR/documentation
MIT License
13 stars 2 forks source link

Support multiple enableWhen expressions per item #52

Closed vishnuravi closed 1 year ago

vishnuravi commented 1 year ago

Support multiple enableWhen expressions per item

:recycle: Current situation & Problem

Currently ResearchKitonFHIR only supports a single enableWhen expression (skip logic) per item in a questionnaire. However, questionnaires may define more than one enableWhen expression to be applied with either an any or all behavior. Converting each enableWhen statement into a separate ORKPredicateSkipStepNavigationRule and then applying them to the step in sequence does not appear to work, as only one of the rules is applied.

:bulb: Proposed solution

This PR attempts to solve this problem by combining the enableWhen statements into a single ORKPredicateSkipStepNavigationRule using NSCompoundPredicate.

Testing

A UI test is included which tests a questionnaire with multiple questions, where an instruction step is shown if all the questions are answered correctly.

Code of Conduct & Contributing Guidelines

By submitting creating this pull request, you agree to follow our Code of Conduct and Contributing Guidelines:

codecov-commenter commented 1 year ago

Codecov Report

Merging #52 (475528e) into main (07d9a24) will increase coverage by 0.20%. The diff coverage is 93.75%.

:exclamation: Current head 475528e differs from pull request most recent head 297ba9a. Consider uploading reports for the commit 297ba9a to get more accurate results

Impacted file tree graph

@@            Coverage Diff             @@
##             main      #52      +/-   ##
==========================================
+ Coverage   88.29%   88.49%   +0.20%     
==========================================
  Files           9        9              
  Lines         649      660      +11     
==========================================
+ Hits          573      584      +11     
  Misses         76       76              
Impacted Files Coverage Δ
...s/FHIRQuestionnaires/Questionnaire+Resources.swift 66.67% <ø> (ø)
...hKitOnFHIR/FHIRToResearchKit/NavigationRules.swift 89.01% <93.75%> (+0.68%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 07d9a24...297ba9a. Read the comment docs.