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

Support Contains for string search #426

Merged
merged 14 commits into from
May 14, 2021
Merged

Conversation

epicadk
Copy link
Contributor

@epicadk epicadk commented Apr 5, 2021

IMPORTANT: All PRs must be linked to an issue (except for extremely trivial and straightforward changes).

Fixes #376
Description

Support contains for string search.

Alternative(s) considered

Explained in the comment on linked issue. I've removed the ParamPrefixEnum as a parameter of string filter because those params are only meant for Number Quantity and date parameters
refer https://www.hl7.org/fhir/search.html#prefix or the ParamPrefixEnum Javadoc

I also cannot find a StringParamModifier Enum like the TokenParamModifier and UriParamQualifierEnum Enums that's why I used the string param class. I think we could possibly create our own implementation of the StringParamModifier class.

The tests I have added to the FHIREngineImpl are from https://www.hl7.org/fhir/search.html#string

Type
Choose one: Feature

Screenshots (if applicable)

Checklist

  • I have read and acknowledged the Code of conduct
  • I have read How to Contribute
  • I have read the Developer's guide
  • I have signed the Google Individual CLA, or I am covered by my company's Corporate CLA
  • I have discussed my proposed solution with code owners in the linked issue(s) and we have agreed upon the general approach
  • I have run ./gradlew spotlessApply and ./gradlew spotlessCheck to check my code follows the style guide of this project
  • I have run ./gradlew check and ./gradlew connectedCheck to test my changes locally
  • I have built and run the reference app(s) to verify my change fixes the issue and/or does not break the reference app(s)

Copy link
Collaborator

@jingtang10 jingtang10 left a comment

Choose a reason for hiding this comment

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

Thanks @epicadk for this change! Just a comment on the syntax for the search API.

@jingtang10
Copy link
Collaborator

Thanks @epicadk - I would really love to focus on the contains issue and handle the change of indexing in a separate PR. Is it ok?

@epicadk
Copy link
Contributor Author

epicadk commented May 14, 2021

Thanks @epicadk - I would really love to focus on the contains issue and handle the change of indexing in a separate PR. Is it ok?

Yep sorry. Reverting the change.

@epicadk epicadk requested a review from jingtang10 May 14, 2021 13:24
@epicadk
Copy link
Contributor Author

epicadk commented May 14, 2021

@jingtang10 done.

Copy link
Collaborator

@jingtang10 jingtang10 left a comment

Choose a reason for hiding this comment

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

thanks!

Improve tests
Improve Formatting
@epicadk
Copy link
Contributor Author

epicadk commented May 14, 2021

@jingtang10 done

Copy link
Collaborator

@jingtang10 jingtang10 left a comment

Choose a reason for hiding this comment

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

Great! Thanks so much for this. Please feel free to merge after addressing the final few (nit) comments.

}
assertThat(res).hasSize(1)
assertThat(res[0].id).isEqualTo("Patient/${patient1.id}")
assertThat(res[0].nameFirstRep.given.any { it.toString() == "Eve" }).isTrue()
Copy link
Collaborator

Choose a reason for hiding this comment

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

i think just checking the patient id is right is enough?

chore: fix formatting
@epicadk epicadk enabled auto-merge May 14, 2021 19:22
@epicadk epicadk merged commit 4a2c5d5 into google:master May 14, 2021
@jingtang10
Copy link
Collaborator

Thanks again @epicadk for this PR and merging!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
FHIR engine library
  
In progress
Development

Successfully merging this pull request may close these issues.

Make the string search match the beginning of the string by default Support contains for string search
3 participants