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

Date query builder uses name instead of xpath #51

Merged
merged 2 commits into from
Aug 21, 2024
Merged

Conversation

elsaperelli
Copy link
Collaborator

Summary

This PR fixes some _typeFilter functionality that we had slightly incorrect for mostly date search parameters. Now we can use the correct search parameters such as Encounter.onset-date.

New behavior

We now properly map search parameters to their xpath so that fhir-qb can properly build a search query. Before, the user could only use _typeFilter queries with the xpath, such as Encounter.onsetDateTime, when the correct search is Encounter.onset-date. This was simply a matter of making sure the parameterDefinitions had the correct keys when being passed into buildSearchQuery.

Code changes

  • src/util/exportToNDJson.js - make sure the search param keys are the name
  • test/util/exportToNDJson.js - change unit tests to have proper _typeFilter search parameters

Testing guidance

  • npm run check
  • npm run start
  • Either use Insomnia to test _typeFilter ... OR (even better!) use the bulk-export-app to make testing even easier (yay Cooper!)
  • Keep in mind that search parameters of type date that map to attributes of type period (ex. Encounter.date) will still not work as expected. This still needs to be addressed in our fork of node-fhir-server-core and there is a task for that in the BL!

Copy link

github-actions bot commented Aug 16, 2024

Coverage report

St.
Category Percentage Covered / Total
🟡 Statements 75.63% 574/759
🟡 Branches 63.19% 206/326
🟡 Functions 75.83% 91/120
🟡 Lines 75.87% 566/746

Test suite run success

95 tests passing in 8 suites.

Report generated by 🧪jest coverage report action from 30afd38

@lmd59 lmd59 self-requested a review August 20, 2024 14:49
@lmd59 lmd59 self-assigned this Aug 20, 2024
Copy link
Contributor

@lmd59 lmd59 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One small code change recommendation inline!

Beyond that, I had difficulty testing this with something other than date-y like things as I couldn't find a field that is

used by our measure data
has a different search parameter name versus the field name
doesn't use a a date type
doesn't use some complex type who's value is an object (our matching on object things, like CodeableConcept seems to be broken as well unless I'm constructing the query incorrectly)
I instead found another example of a simple date query where the date is just a datetime (cannot be some other date-like thing), and I found that to be successful:
http://localhost:3000/$export?_type=DeviceRequest&_typeFilter=DeviceRequest%3Fauthored-on%3Deq2019-01-01T00%3A00%3A00.000Z

I think that we should probably add more testing of object-like (token/reference/etc.) search parameters to our backlog task, but after the comment change, this PR in and of itself can probably be pulled in.

src/util/exportToNDJson.js Outdated Show resolved Hide resolved
@elsaperelli elsaperelli requested a review from lmd59 August 21, 2024 15:49
@elsaperelli elsaperelli merged commit 1ba05f4 into main Aug 21, 2024
4 checks passed
@elsaperelli elsaperelli deleted the typef-fix branch August 21, 2024 15:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants