@healthcare-interoperability/fhir-query-mongo-store

0.2.0 • Public • Published

@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 updateOne with upsert
  • 📦 Handles integration IDs and task-based processing
  • 🧩 Built for composability and subclassing

Installation

npm install @healthcare-interoperability/fhir-query-mongo-store

Usage

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


License

MIT

Package Sidebar

Install

npm i @healthcare-interoperability/fhir-query-mongo-store

Weekly Downloads

2

Version

0.2.0

License

MIT

Unpacked Size

15.2 kB

Total Files

10

Last publish

Collaborators

  • darkknight
  • carnivalofrust
  • ageofai