Closed Supereg closed 6 months ago
Attention: Patch coverage is 71.30435%
with 132 lines
in your changes are missing coverage. Please review.
Project coverage is 81.95%. Comparing base (
7cd02fe
) to head (ddeadcc
).
The generated parser dramatically reduces our code coverage. Not sure if it makes sense to exclude it somehow from the codecov report?
The generated parser dramatically reduces our code coverage. Not sure if it makes sense to exclude it somehow from the codecov report?
This is incredible work @Supereg! :rocket:
Perhaps it makes sense to make the FHIRPathParser
into a separate Swift package or part of SpeziFHIR? This would not only address the code coverage issue, but also make it easier to use for other use cases beyond ResearchKit surveys, and could be expanded beyond date expressions in the near future.
Perhaps it makes sense to make the FHIRPathParser into a separate Swift package or part of SpeziFHIR? This would not only address the code coverage issue, but also make it easier to use for other use cases beyond ResearchKit surveys, and could be expanded beyond date expressions in the near future.
As discussed, I think that would be a great step forward to eventually branch it out into a SpeziFHIR package. However, this would probably require a bit more work building a proper abstract syntax tree (AST) around the current syntax tree generated by Antlr. So for now, let's leave it as an internal target that just drives some of our features 🚀
Perhaps it makes sense to make the FHIRPathParser into a separate Swift package or part of SpeziFHIR? This would not only address the code coverage issue, but also make it easier to use for other use cases beyond ResearchKit surveys, and could be expanded beyond date expressions in the near future.
As discussed, I think that would be a great step forward to eventually branch it out into a SpeziFHIR package. However, this would probably require a bit more work building a proper abstract syntax tree (AST) around the current syntax tree generated by Antlr. So for now, let's leave it as an internal target that just drives some of our features 🚀
Sounds good to me!
Add support for FHIRPath expression-based, relative min and max date extensions
:recycle: Current situation & Problem
Currently, with
date
questionnaire items, FHIR only supports exact min and max date values (e.g., exact date like 2024-04-14). However, as it is typical with, e.g., a date of birth picker, you want to restrict the max date relative to the current date (e.g., no value larger than today). Equally, specifying a min value that is relative to the current time might be desirable.The Phoenix builder currently supports specifying such relative date ranges using FHIRPath expressions. This looks something like
today() + 3 months
or justtoday()
. See FHIRPath and Current date and time functions.This PR adds functionality for these expressions, implementing a parsers for the FHIRPath Grammar using Antlr4. It uses the generated syntax tree parser and implements a just in time evaluation for date expressions. All these operations are implemented in the internal
FHIRPathParser
target.Consequentially, we integrate that with the ResearchKitOnFHIR conversion logic to consider the extensions from phoenix and parse the respective expressions.
:gear: Release Notes
date
anddateTime
questionnaire items.:books: Documentation
Documentation was added for all new infrastructure.
:white_check_mark: Testing
Unit tests were added to verify the implementation for the date expression evaluation.
Code of Conduct & Contributing Guidelines
By submitting creating this pull request, you agree to follow our Code of Conduct and Contributing Guidelines: