@inclouded/fhir-specimen
TypeScript icon, indicating that this package has built-in type declarations

2.0.0 • Public • Published

FHIR Specimen Firestore SDK

npm install --save @inclouded/fhir-specimen

Introduction

In the repository the Firebase Cloud Firestore SDK can be found that was made for the FHIR Specimen resource in an installable Angular folder form. The SDK can be installed for every Angular 2+ project. The SDK accomplishes the necessary CRUD operations.

Usage

  1. For using the SDK an Angular 2+ project is needed, in which we can establish a connection to a Firestore database instance. (configured in environments.ts)

  2. The SDK can be used in a Service in the following way:

import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { SpecimenApi } from '@inclouded/fhir-specimen';
import { ISpecimen } from '@ahryman40k/ts-fhir-types/lib/R4';
import { AngularFirestore } from '@angular/fire/firestore';

@Injectable()
export class SpecimenService {

  SpecimenApi: SpecimenApi;
  constructor(private afs: AngularFirestore) {
    this.SpecimenApi = new SpecimenApi(this.afs);
  }

  addSpecimen(specimen: ISpecimen) {
    return this.SpecimenApi.add(specimen);
  }

  getAllSpecimens(): Observable<ISpecimen[]> {
    return this.SpecimenApi.getAll();
  }

  getSpecimensByMetaAndStatus(meta?: string, status?: string): Observable<ISpecimen[]> {
    return this.SpecimenApi.getSpecimensByMetaAndStatus(meta, status);
  }

  deleteSpecimen(specimenId: string){
    return this.SpecimenApi.delete(specimenId);
  }

  updateSpecimen(specimen: ISpecimen) {
    return this.SpecimenApi.update(specimen);
  }

}

Usage with MongoDB

See in the description of FhirApi: a link

The Specimen class must be equal with the form.value, this way there's no need for building the object locally. For the usage of the more complex objects there are more available interfaces, the Specimen of Provenance that possess more complex objects build upon these.

Developer: Zoltán R. Jánki (jankiz@inf.u-szeged.hu), Gábor Simon (simonovszkij@gmail.com)

Readme

Keywords

none

Package Sidebar

Install

npm i @inclouded/fhir-specimen

Weekly Downloads

2

Version

2.0.0

License

none

Unpacked Size

80.3 kB

Total Files

26

Last publish

Collaborators

  • zbiacsi
  • bilickiv
  • m2m-deploy
  • jankiz
  • grindy