bonFHIR Documentation

website·Indexed 31 days ago

https://bonfhir.dev/

A framework for building FHIR-based solutions, featuring a suite of packages including React components for FHIR data display and input, GraphQL query and mutation hooks, subscription handlers, a CLI for resource import, and specialized support for US Core.

Tokens
48.5K
Snippets
226
Records
273
Agent score
60%

What's inside bonFHIR

  1. Overview of BonFHIR capabilities

    BonFHIR is a suite of projects and libraries designed to accelerate the development of FHIR-based products. It provides the following core capabilities:

    • React UI components and state management tailored for FHIR resources and healthcare use cases.
    • Type definitions for FHIR R4b and R5, including search builder parameters.
    • Localized formatters for presenting FHIR data (names, dates, addresses, etc.) in multiple languages.
    • A comprehensive FHIR client supporting subscriptions, bundle navigation, dynamic proxies, batch execution, and GraphQL.
  2. Overview of @bonfhir/query for FHIR data fetching

    The @bonfhir/query package provides a set of hooks designed to manage FHIR data fetching within React and React Native applications. It is built on top of Tanstack Query (React Query) v5 to handle complex state management tasks such as fetching strategies, cache invalidation, data freshness, and loading/error cycles automatically.
  3. Overview of BonFHIR capabilities

    BonFHIR is a developer framework designed to reduce the 'plumbing' required when building healthcare applications. It ensures data compliance with the latest health specifications (FHIR) and provides a suite of tools for data modeling, API interaction, and UI development.
  4. Overview of the bonFHIR IG Toolbox

    The bonFHIR IG Toolbox is a Docker-based suite of tools designed to author and generate FHIR Implementation Guides (IGs). It removes the need for manual installation of the toolchain on a local workstation. The only prerequisites are Docker and (recommended) Visual Studio Code.
  5. Interact with FHIR APIs using bonFHIR Actions

    The bonFHIR node for n8n provides a set of actions to interact with a FHIR API. Supported actions include:

    • Create, Delete, Read, Update, and Patch FHIR Resources
    • Get the history of a FHIR Resource
    • Get a specific version of a FHIR Resource
    • Search FHIR Resources
    • Resolve FHIR references
  6. Use the FhirInput component for FHIR-compliant form inputs

    The <FhirInput /> is a React controlled component designed for form inputs that natively handle FHIR data types. Key features include:

    • Automatic formatting for date and dateTime types.
    • Handling of empty values: empty strings are automatically converted to undefined to maintain FHIR compliance.
    • Native support for terminology, references, and resource searches.
    • Support for composite data types such as Identifier, HumanName, Address, and ContactPoint.

    While it can be used with standard useState, it is recommended to use it with form hooks like useFhirForm or useFhirResourceForm for complex forms.

  7. Understand bonFHIR package organization and scope

    bonFHIR is organized into modular packages so that implementations only include necessary dependencies. Packages are categorized by their target environment:

    • Client and Server (Full Stack): @bonfhir/core, @bonfhir/us-core, and @bonfhir/next.
    • Client-only: @bonfhir/query, @bonfhir/react, @bonfhir/mantine, and @bonfhir/gluestack-ui.
    • Server-only: @bonfhir/subscriptions and @bonfhir/aws-lambda.
    • Utilities (Not for project inclusion): @bonfhir/cli, create-bonfhir, and @bonfhir/codegen.
  8. Manage FHIR query lifecycles with <FhirQueryLoader />

    The <FhirQueryLoader /> component manages the loading, success, and error lifecycle of one or more FHIR queries. It provides a managed solution for client-side error handling by automatically rendering a loader during the initial request and rendering a <FhirError /> component (with an automatic retry button) if the query fails. Children are only rendered upon successful query execution.
  9. Integrate bonFHIR with n8n using @bonfhir/n8n-nodes-bonfhir

    The @bonfhir/n8n-nodes-bonfhir package is a community node for n8n that enables the use of FHIR Actions and Triggers within visual workflows. This allows developers to build complex healthcare data automations and integrate FHIR-based systems with other third-party apps and services available in the n8n ecosystem.
  10. Use the bonFhir CLI for application and data management

    The @bonfhir/cli package provides a set of command-line utilities to create bonFHIR applications and manage FHIR data. It is recommended to use the @bonfhir/cli@latest moniker to ensure the most recent version is executed via npx.
    # Get general help
    npx @bonfhir/cli@latest --help
    
    # Get help for a specific command
    npx @bonfhir/cli@latest <command> --help
    
    # Check the current CLI version
    npx @bonfhir/cli@latest --version
  11. Manage FHIR data state with Mutation hooks

    Bonfhir provides a set of Mutation hooks (based on TanStack Query v5) to modify FHIR resources. Unlike queries, mutations do not execute automatically; they must be triggered by a user action. A key feature of these hooks is that they integrate with the <FhirQueryProvider />, which automatically refreshes the query cache when a mutation occurs. This eliminates the need for developers to manually manage data refresh dependencies or write complex invalidation logic across the application.
  12. Install and use @bonfhir/subscriptions for FHIR R4B

    The @bonfhir/subscriptions package is used to manage and handle server-side FHIR Subscriptions, acting similarly to webhooks to react to resource modifications in a FHIR server.

    Key Constraints:

    • FHIR Version: Currently only compatible with FHIR version R4B. It does not support the R5 subscription model.
    • Subscription Type: Only supports subscriptions of type rest-hook.
    • Architecture: This is a core package that requires additional adapter packages depending on the hosting model (e.g., AWS Lambda or Next.js).
    npm install @bonfhir/subscriptions