Socket
Book a DemoInstallSign in
Socket

@ahryman40k/ts-fhir-types

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ahryman40k/ts-fhir-types

Typescript / Javascript object model for FHIR standard Model follows FHIR R4 specifications.

latest
Source
npmnpm
Version
4.0.39
Version published
Weekly downloads
16K
23.77%
Maintainers
1
Weekly downloads
 
Created
Source

typescript-fhir-types

Typescript / Javascript object model for FHIR standard Model follows FHIR R4 specifications.

npm version Build Status codecov Known Vulnerabilities Project dependencies overview(Beta) License: GPL v3

Definitions are io-ts based interfaces. See io-ts github project for further details. This means you can check your types at runtime.

Installation

npm i -S @ahryman40k/ts-fhir-types

or

yarn install @ahryman40k/ts-fhir-types

articles

A medium article: Handle FHIR objects with Typescript

Examples

let's imagine your server or your application is receiving a FHIR Resource like an observation from a server or any external system

import { R4 } from '@ahryman40k/ts-fhir-types'
import { either as E } from 'fp-ts'

const json = {
    "resourceType":"Patient"   
 };

const  validationResult = R4.RTTI_Patient.decode(json)

if ( E.isLeft( validationResult) ) {
    console.log(validationResult.left);
}

if ( E.isRight( validationResult) ) {
    console.log(validationResult.right);
}

There is 2 points:

  • You would like to have strongly typed types (typescript)
  • You would validate data returned from server and test their validity against FHIR standard

FHIR resources are also provided as interface, so you can inherit and implement your own object implementation.

Please don't hesitate to give me advice and feedback !

FAQs

Package last updated on 11 Feb 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts