Options
All
  • Public
  • Public/Protected
  • All
Menu

This is a basic FHIR client for making basic FHIR API calls

Hierarchy

Index

Constructors

  • new default(fhirBaseUrl: string): default
  • Validates the parameters, creates an instance and tries to connect it to FhirJS, if one is available globally.

    Parameters

    • fhirBaseUrl: string

    Returns default

Properties

fhirBaseUrl: string

The state of the client instance is an object with various properties. It contains some details about how the client has been authorized and determines the behavior of the client instance. This state is persisted in SessionStorage in browsers or in request session on the servers.

Other Methods

  • fetchReferences(resource: Resource, references: string[], graph: boolean, cache?: Record<string, any>, requestOptions?: Omit<RequestOptions, "url">): Promise<Record<string, any>>
  • Parameters

    • resource: Resource
    • references: string[]
    • graph: boolean
    • cache: Record<string, any> = {}
    • requestOptions: Omit<RequestOptions, "url"> = {}

    Returns Promise<Record<string, any>>

  • fhirRequest<T>(uri: string | URL, options?: RequestOptions): Promise<T>
  • The method responsible for making all http requests

    Type Parameters

    • T = any

    Parameters

    • uri: string | URL
    • options: RequestOptions = {}

    Returns Promise<T>

  • getFhirRelease(): Promise<number>
  • Returns a promise that will be resolved with the numeric fhir version

    • 2 for DSTU2
    • 3 for STU3
    • 4 for R4
    • 0 if the version is not known

    Returns Promise<number>

  • getFhirVersion(): Promise<string>
  • Returns a promise that will be resolved with the fhir version as defined in the CapabilityStatement.

    Returns Promise<string>

  • getReferences(resource: Resource, references: string[], requestOptions?: Omit<RequestOptions, "url">): Promise<Record<string, Resource>>
  • Fetches all references in the given resource, ignoring duplicates

    Parameters

    • resource: Resource
    • references: string[]
    • requestOptions: Omit<RequestOptions, "url"> = {}

    Returns Promise<Record<string, Resource>>

  • pages(bundleOrUrl: string | URL | Bundle<FhirResource>, requestOptions?: RequestOptions): AsyncGenerator<Bundle<FhirResource>, void, unknown>
  • Given a FHIR Bundle or a URL pointing to a bundle, iterates over all pages. Note that this will automatically crawl through further pages (if any) but it will not detect previous pages. It is designed to be called on the first page and fetch any followup pages.

    Parameters

    • bundleOrUrl: string | URL | Bundle<FhirResource>
    • Optional requestOptions: RequestOptions

    Returns AsyncGenerator<Bundle<FhirResource>, void, unknown>

  • resolveRef(obj: Resource, path: string, graph: boolean, cache: Record<string, any>, requestOptions?: Omit<RequestOptions, "url">): Promise<undefined | (undefined | void)[]>
  • Parameters

    • obj: Resource
    • path: string
    • graph: boolean
    • cache: Record<string, any>
    • requestOptions: Omit<RequestOptions, "url"> = {}

    Returns Promise<undefined | (undefined | void)[]>

  • resolveReferences(resource: Resource, references: string[], requestOptions?: Omit<RequestOptions, "url">): Promise<void>
  • Fetches all references in the given resource, ignoring duplicates, and then modifies the resource by "mounting" the resolved references in place

    Parameters

    • resource: Resource
    • references: string[]
    • requestOptions: Omit<RequestOptions, "url"> = {}

    Returns Promise<void>

  • resources(bundleOrUrl: string | URL | Bundle<FhirResource>, options?: RequestOptions): AsyncGenerator<undefined | FhirResource, void, unknown>
  • Given a FHIR Bundle or a URL pointing to a bundle, iterates over all entry resources. Note that this will also automatically crawl through further pages (if any)

    Parameters

    • bundleOrUrl: string | URL | Bundle<FhirResource>
    • Optional options: RequestOptions

    Returns AsyncGenerator<undefined | FhirResource, void, unknown>

Request Methods

  • delete<R>(url: string, requestOptions?: FetchOptions): Promise<R>
  • Removes an existing resource.

    see

    http://hl7.org/fhir/http.html#delete

    Type Parameters

    • R = unknown

    Parameters

    • url: string

      Relative URI of the FHIR resource to be deleted (format: resourceType/id)

    • requestOptions: FetchOptions = {}

      Any options (except method which will be fixed to DELETE) to be passed to the fetch call.

    Returns Promise<R>

  • Makes a JSON Patch to the given resource

    see

    http://hl7.org/fhir/http.html#patch

    since

    2.4.0

    Type Parameters

    • ResolveType = Resource

      This method would typically resolve with the patched resource or reject with an OperationOutcome. However, this may depend on the server implementation or even on the request headers. For that reason, if the default resolve type (which is fhirclient.FHIR.Resource) does not work for you, you can pass in your own resolve type parameter.

    Parameters

    • url: string

      Relative URI of the FHIR resource to be patched (format: resourceType/id)

    • patch: JsonPatch

      A JSON Patch array to send to the server, For details see https://datatracker.ietf.org/doc/html/rfc6902

    • requestOptions: FetchOptions = {}

      Any options to be passed to the fetch call, except for method, url and body which cannot be overridden.

    Returns Promise<ResolveType>

Generated using TypeDoc