1.0.3 • Published 9 months ago

@fhir-uck/fhir-client v1.0.3

Weekly downloads
-
License
SEE LICENSE IN LI...
Repository
github
Last release
9 months ago

FHIR Client

npm version PRs Welcome HitCount NPM

A TypeScript client library for interacting with FHIR (Fast Healthcare Interoperability Resources) servers. This library provides a simple and type-safe API for handling FHIR resources.

繁體中文說明

Features

  • Support for multiple FHIR versions (R2, R3, R4, R4B, R5)
  • Full TypeScript type support
  • Axios-based HTTP client
  • Authentication token support
  • Basic CRUD operations

Installation

npm install @fhir-uck/fhir-client
# or
yarn add @fhir-uck/fhir-client

Usage

Initialize Client

import { FHIRClient } from '@fhir-uck/fhir-client';

const client = new FHIRClient({
  baseUrl: 'https://your-fhir-server.com/fhir',
  token: 'your-access-token', // optional
  version: 'R4' // optional, defaults to 'R4'
});

Basic Operations

Get Resource

// Get by ID
const patient = await client.get('Patient', 'patient-id');

// Get by parameters
const patients = await client.get('Patient', {
  name: 'John',
  birthdate: '1970-01-01',
  gender: 'male'
});

// Get by ID with parameters
const patientWithParams = await client.get('Patient', 'patient-id', {
  _include: 'Patient:organization',
  _elements: ['name', 'birthDate', 'gender']
});

Create Resource

const newPatient = await client.post({
  resourceType: 'Patient',
  name: [{ given: ['John'], family: 'Doe' }]
});

Update Resource

const updatedPatient = await client.put({
  resourceType: 'Patient',
  id: 'patient-id',
  name: [{ given: ['John'], family: 'Smith' }]
});

Delete Resource

await client.delete('Patient', 'patient-id');

Contributing

Pull requests and issues are welcome!

License

For users outside Taiwan: This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License (CC BY-NC-SA 4.0).

You are free to:

Share — copy and redistribute the material in any medium or format
Adapt — remix, transform, and build upon the material

Under the following terms:

Attribution — You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
NonCommercial — You may not use the material for commercial purposes.
ShareAlike — If you remix, transform, or build upon the material, you must distribute your contributions under the same license as the original.

For more details, please refer to the LICENSE file.

© 2023 Lorex and Sitatech Information Services Co., Ltd. All Rights Reserved.

1.0.3

9 months ago

1.0.2

9 months ago

1.0.1

9 months ago

1.0.0

9 months ago