Socket
Socket
Sign inDemoInstall

@medplum/core

Package Overview
Dependencies
Maintainers
1
Versions
186
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@medplum/core

Medplum TS/JS Library


Version published
Weekly downloads
8K
decreased by-32.55%
Maintainers
1
Weekly downloads
 
Created
Source

Medplum

Medplum is a healthcare platform that helps you quickly develop high-quality compliant applications. Medplum includes a FHIR server, React component library, and developer app.

Medplum JS Client Library

The Medplum JS Client Library is a pure TypeScript library for calling a FHIR server from the browser.

Key Features

  • FHIR validation and operations
  • FHIR client to create, read, update, delete, patch, and search
  • WebSockets for realtime communication
  • Evaluation of FhirPath
  • No external dependencies

Installation

npm install medplum

Basic Usage

import { MedplumClient } from '@medplum/core';

const medplum = new MedplumClient({
    baseUrl: 'https://www.example.com/fhir/R4/',
    clientId: 'MY_CLIENT_ID'
});

Authenticating with OAuth

Authenticate with a FHIR server via OAuth2 redirect:

medplum.signInWithRedirect().then(user => console.log(user));

Authenticating with Medplum

If you are using Medplum as your FHIR server, you can use a direct sign-in API to authenticate email and password.

Before you begin

  1. Create a project in the Medplum App
  2. Enable Email/Password

After that, you can use the signIn() method:

medplum.signIn(email, password, role, scope).then(user => console.log(user));

Search for any resource using a FHIR search string:

medplum.search('Patient?given=eve').then(bundle => {
  bundle.entry.forEach(entry => console.log(entry.resource));
});

Search using a structured object:

medplum.search({
  resourceType: 'Patient',
  filters: [{
    code: 'given',
    operator: Operator.EQUALS,
    value: 'eve'
  }]
}).then(bundle => {
  bundle.entry.forEach(entry => console.log(entry.resource));
});

Create

Create a new resource:

medplum.create({
  resourceType: 'Observation',
  subject: {
    reference: 'Patient/123'
  },
  valueQuantity: {
    // ...
  }
  // ...
});

Read

Read a resource by ID:

medplum.read('Patient', '123');

Read resource history:

medplum.readHistory('Patient', '123');

Read a specific version:

medplum.readVersion('Patient', '123', '456');

License

Apache 2.0. Copyright © Medplum 2021

Keywords

FAQs

Package last updated on 05 Nov 2021

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc