MEDrecord Angular Services to deal with medical data


1.0.244 years ago4 years agoMinified + gzip package size for @medrecord/medquery in KB


MEDrecord Query

Angular Services to deal with medical data


To install this library, run:

$ npm install @medrecord/medquery --save

Consuming your library

Once you have published your library to npm, you can import your library in any Angular application by running:

$ npm install @medrecord/medquery

and then from your Angular AppModule:

import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';

import { AppComponent } from './app.component';

// Import your library
import { MedqueryModule } from '@medrecord/medquery';

  declarations: [
  imports: [
    MedqueryModule.forRoot({apiUrl: 'https://your-backend/api'})
  providers: [],
  bootstrap: [AppComponent]
export class AppModule { }


Add medical data (composition)

import { BloodPressureComposition, BloodPressureService } from '@medrecord/medquery';

class YourComponentClass {

  constructor(private bp: BloodPressureService) {


  addBloodPressureData() {

    const composition: BloodPressureComposition = {
      ehrId: yourTargetEhrId,
      metadata: {
        territory: yourTargetCountryCode,
        language: yourTargetLanguage,
        context: {
          startTime: moment().format(),
          location: yourTargetLocation,
          healthCareFacility: {
            name: yourTargetHealthCareFacilityName,
            identifier: yourTargetHealthCareFacilityId
        composer: {
          identifier: yourTargetPersonMvUid || 'ANONYMOUS',
          name: yourTargetPersonDisplayName || 'ANONYMOUS'
      data: {
        bloodPressure: {
          diastolic: bloodPressureDiastolicValueHere,
          systolic: bloodPressureSystolicValueHere
        hearthRatePulse: {
          rate: heartRateValueHere

    // Add the composition
      res => console.log('success', res),
      err => console.log('error', err)



Read medical data

By EHR ID and Composition ID

import { CompositionService } from '@medrecord/medquery';

class YourComponentClass {

  constructor(private cs: CompositionService) {


  readCompositionById() {

    const params = {
      ehrId: yourTargetEhrId,
      compositionId: yourTargetCompositionId,
      format: 'ECISFLAT' // options are: 'FLAT', 'ECISFLAT', 'RAW' or 'XML'

      res => console.log('success', res),
      err => console.log('error', err)



By EHR ID and Template ID

Coming soon

By Template ID (all EHR IDs)

Coming soon


To generate all *.js, *.d.ts and *.metadata.json files:

$ npm run build

To lint all *.ts files:

$ npm run lint


LGPL-2.0 © MEDrecord

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.