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

feat: adds new feature Fhir.es_sql() #217

Merged
merged 2 commits into from
Mar 13, 2024
Merged

feat: adds new feature Fhir.es_sql() #217

merged 2 commits into from
Mar 13, 2024

Conversation

shawnzhu
Copy link
Member

This will invoke the OpenSearch SQL that supports:

  1. prepared statement - so that it could inject parameters via params. see test case
  2. pagination via LIMIT {offset},{page_size} - so it doesn't need scroll_id.
  3. resultset could be transfromed to dataframe directly. for instance:
df = fhir.es_sql(
    project_id='xxx',
    statement='SELECT id, subject FROM diagnostic_report WHERE identifier.system = ? LIMIT 10',
    params=[{
      "type": "string",
      "value": "example-identifier-system"
    }]
).get_as_dataframe('datarows')

@shawnzhu shawnzhu added the enhancement New feature or request label Mar 12, 2024
epeters3
epeters3 previously approved these changes Mar 13, 2024
Copy link
Contributor

@epeters3 epeters3 left a comment

Choose a reason for hiding this comment

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

Looks good, nice addition. I think the existing sql and execute_sql methods don't even work anymore. It would be nice to remove them, except there could be some edge case and some customer that's still using them in their notebooks.

@epeters3
Copy link
Contributor

@shawnzhu if you want this change to be published in a new version of the package, I think you need to manually update the package version in pyproject.toml. See https://github.com/lifeomic/phc-sdk-py/blob/master/CONTRIBUTING.md

@shawnzhu shawnzhu merged commit f616345 into master Mar 13, 2024
6 checks passed
@shawnzhu shawnzhu deleted the fhir-sql branch March 13, 2024 14:55
shawnzhu added a commit that referenced this pull request Mar 13, 2024
feat: adds new feature Fhir.es_sql()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants