0.2.0 • Published 6 months ago
@healthcare-interoperability/fhir-query-mongo-store v0.2.0
@healthcare-interoperability/fhir-query-mongo-store
MongoDB-specific query builder for FHIR resources, built on top of fhir-query-store.
@healthcare-interoperability/fhir-query-mongo-store provides MongoDB-compatible query generation utilities for storing and updating FHIR resources using bulk operations. It extends the generic FHIR query framework provided by @healthcare-interoperability/fhir-query-store, enabling support for real-world healthcare integration workflows and storage patterns.
Features
- 🔁 Supports FHIR Bundles (type
collection,transaction, etc.) - ⚙️ Converts FHIR resources into
bulkWrite-ready MongoDB update queries - 🧠 Optimized for idempotent operations using
updateOnewithupsert - 📦 Handles integration IDs and task-based processing
- 🧩 Built for composability and subclassing
Installation
npm install @healthcare-interoperability/fhir-query-mongo-storeUsage
import { FHIRMongoBundleProcessor } from '@healthcare-interoperability/fhir-query-mongo-store';
const bundle = {
resourceType: 'Bundle',
type: 'collection',
entry: [/* array of FHIR resources */]
};
const processor = new FHIRMongoBundleProcessor(bundle)
.setIntegrationId('your-integration-id');
const queries = processor.query();
// `queries` is an object keyed by resource type, each with an array of MongoDB operations
// e.g. { Patient: [ { updateOne: { filter, update, upsert: true } } ] }API
FHIRMongoBundleProcessor
Processes a FHIR bundle and generates MongoDB-compatible update queries.
Constructor
new FHIRMongoBundleProcessor(bundle)bundle: A valid FHIR Bundle or single resource.
.setIntegrationId(integrationId)
Sets an integration ID to associate with all processed queries.
.query()
Returns an object where each key is a FHIR resource type (e.g., "Patient") and the value is an array of MongoDB update queries ready for bulkWrite.
Related Packages
@healthcare-interoperability/fhir-query-store: Generic FHIR query generation framework used as the base for MongoDB and other data stores.
License
MIT