@medrecord/medquery
v1.0.24
Published
MEDrecord Angular Services to deal with medical data
Downloads
90
Readme
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