{"id":51146394,"url":"https://github.com/sassoftware/sqlonfhir","last_synced_at":"2026-06-26T03:01:38.535Z","repository":{"id":313980459,"uuid":"1053655768","full_name":"sassoftware/sqlonfhir","owner":"sassoftware","description":"A Python implementation for evaluating SQL on FHIR view definitions against FHIR resources using FHIRPath expressions","archived":false,"fork":false,"pushed_at":"2026-05-07T17:40:13.000Z","size":50,"stargazers_count":7,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-07T19:36:15.962Z","etag":null,"topics":["sas-utilities"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sassoftware.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-09-09T18:41:24.000Z","updated_at":"2026-05-07T17:40:19.000Z","dependencies_parsed_at":"2025-09-09T23:13:39.078Z","dependency_job_id":"6477df3f-cdce-4b10-8b67-762ad536766d","html_url":"https://github.com/sassoftware/sqlonfhir","commit_stats":null,"previous_names":["sassoftware/sqlonfhir"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/sassoftware/sqlonfhir","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sassoftware%2Fsqlonfhir","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sassoftware%2Fsqlonfhir/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sassoftware%2Fsqlonfhir/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sassoftware%2Fsqlonfhir/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sassoftware","download_url":"https://codeload.github.com/sassoftware/sqlonfhir/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sassoftware%2Fsqlonfhir/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34801014,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-26T02:00:06.560Z","response_time":106,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["sas-utilities"],"created_at":"2026-06-26T03:01:37.705Z","updated_at":"2026-06-26T03:01:38.524Z","avatar_url":"https://github.com/sassoftware.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SQL on FHIR\n\nA Python implementation that converts FHIR resources into tabular formats.\n\n## Overview\n\nThis library provides functionality to transform FHIR resources into tabular data structures based on SQL on FHIR view definitions. It extends the `fhirpathpy` library with custom functions and handles the conversion of FHIR resources into structured data that can be used for analytics and reporting. This repository currently used the FHIR R4 specification.\n\n## Features\n\n- **FHIRPath Expression Evaluation**: Evaluates FHIRPath expressions against FHIR resources\n- **SQL on FHIR View Processing**: Processes view definitions to extract structured data\n- **Union Operations**: Supports `unionAll` operations for combining multiple data sources\n- **Conditional Processing**: Handles `where` clauses and conditional logic\n- **Column Mapping**: Maps FHIR resource elements to named columns\n- **Iteration Support**: Provides `forEach` and `forEachOrNull` operations\n\n## Installation\n\n```bash\npip install sqlonfhir\n```\n\n## Dependencies\n\n- `fhirpathpy`: Core FHIRPath evaluation engine\n- `antlr4-python3-runtime`: ANTLR runtime for parsing\n- `python-dateutil`: Date/time utilities\n\n## Usage\n\n```python\nfrom sqlonfhir import evaluate\n\n# Define your view definition\nview_definition = {\n    \"resource\": \"Patient\",\n    \"column\": [\n        {\"name\": \"id\", \"path\": \"id\"},\n        {\"name\": \"name\", \"path\": \"name.given.first()\"}\n    ]\n}\n\n# Your FHIR resources\nresources = [\n    {\n        \"resourceType\": \"Patient\",\n        \"id\": \"patient1\",\n        \"name\": [{\"given\": [\"John\"], \"family\": \"Doe\"}]\n    }\n]\n\n# Evaluate the view\nresult = evaluate(resources, view_definition)\nprint(result)\n```\n\n## API\n\n### `evaluate(resources, view_definition)`\nMain evaluation function that processes FHIR resources against a view definition.\n\n**Parameters:**\n- `resources`: List of FHIR resources to process\n- `view_definition`: SQL on FHIR view definition\n\n**Returns:**\n- List of dictionaries representing the extracted tabular data\n\n## Testing\n\nRun the test suite:\n```bash\nuv run pytest\n```\n\nGenerate test report:\n```bash\n./generate_test_report.sh\n```\n\n## Project Structure\n\n```\nsqlonfhir/\n├── sqlonfhir/\n│   ├── __init__.py\n│   └── sqlonfhir.py          # Main implementation\n├── tests/\n│   ├── resources/          # Test FHIR resources and view definitions\n│   └── tests.py             # Test suite\n├── test_report/           # Test reporting utilities\n├── pyproject.toml       # Project configuration\n└── README.md             # This file\n```\n\n## Contributing\n\nMaintainers are accepting patches and contributions to this project.\nPlease read [CONTRIBUTING.md](CONTRIBUTING.md) for details about submitting contributions to this project.\n\n## License\n\nThis project is licensed under the [Apache 2.0 License](LICENSE).\n\nThose implementing FHIR projects should ensure they have the appropriate licenses to cover any required third party data standards.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsassoftware%2Fsqlonfhir","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsassoftware%2Fsqlonfhir","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsassoftware%2Fsqlonfhir/lists"}