lifeomic / phc-sdk-py

The phc-sdk-py is a developer kit for interfacing with the PHC API on Python 3.8 and above.
https://lifeomic.github.io/phc-sdk-py/index.html
MIT License
1 stars 2 forks source link

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

Closed shawnzhu closed 6 months ago

shawnzhu commented 6 months ago

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')
epeters3 commented 6 months ago

@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