@medrecord/medquery
TypeScript icon, indicating that this package has built-in type declarations

1.0.24 • Public • Published

MEDrecord Query

Angular Services to deal with medical data

Installation

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';

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

Usage

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
    this.bp.addComposition(composition).subscribe(
      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'
    };

    this.cs.getComposition(params).subscribe(
      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

Development

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

$ npm run build

To lint all *.ts files:

$ npm run lint

License

LGPL-2.0 © MEDrecord

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.24
    0
    • latest

Version History

Package Sidebar

Install

npm i @medrecord/medquery

Weekly Downloads

1

Version

1.0.24

License

LGPL-2.0

Unpacked Size

67.7 kB

Total Files

22

Last publish

Collaborators

  • alexander.dev
  • edin.medrecord
  • janmarc