FHIR helper functions

When working with FHIR resources, we can create helper functions to simplify common tasks such as resource extraction, transformation, and conversion.

Resource Extraction:
extractResource(bundle, resourceType): Given a FHIR bundle and a resource type, this function would extract all resources of the specified type from the bundle.

Resource Searching:
searchResources(bundle, searchCriteria): Searches for resources in a bundle based on specific criteria (e.g., based on a certain field value).

Resource Conversion:
convertResourceToFhir(resourceObject): Converts a resource object (e.g., a JavaScript object) into a FHIR resource representation and vise versa

Resource Filtering:
filterResources(bundle, filterFunction): Filters the resources in a bundle based on a custom filtering function.
@mtuchi wdyt

Hi @mahaomolise92, Thank you for the suggestions
It’s an excellent idea, and I believe it would enhance FHIR adaptor significantly.

Would you be interested in opening a pull request for this? I have open an issue on our adaptors monorepo to track your suggestion, see the issue here and i have set a boilerplate for you to begin with, See the draft pr here

Looking forward to your thoughts!

Thanks @mtuchi, I am definately interested in opening a pr for this.

1 Like