3.0.0 • Published 3 years ago

@inclouded/fhir-allergyintolerance v3.0.0

Weekly downloads
12
License
-
Repository
-
Last release
3 years ago

FHIR AllergyIntolerance Firestore SDK

npm install --save @inclouded/fhir-allergyintolerance

Introduction

In the repository the Firebase Cloud Firestore SDK can be found that was made for the FHIR AllergyIntolerance 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 { AllergyIntoleranceApi } from '@inclouded/fhir-allergyintolerance';
import { IAllergyIntolerance } from '@ahryman40k/ts-fhir-types/lib/R4';
import { AngularFirestore } from '@angular/fire/firestore';

@Injectable()
export class AllergyIntoleranceService {

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

  getAllAllergyIntolerances(): Observable<IAllergyIntolerance[]> {
    return this.AllergyIntoleranceApi.getAll();
  }

  addAllergyIntolerance(allergyIntolerance: IAllergyIntolerance) {
    return this.AllergyIntoleranceApi.add(allergyIntolerance);
  }


  deleteAllergyIntolerance(allergyIntoleranceId: string) {
    return this.AllergyIntoleranceApi.delete(allergyIntoleranceId);
  }


  updateAllergyIntolerance(allergyIntolerance: IAllergyIntolerance) {
    return this.AllergyIntoleranceApi.update(allergyIntolerance);
  }


  getAllAllergyIntoleranceByPatient(patient: string): Observable<IAllergyIntolerance[]> {
    return this.AllergyIntoleranceApi.getAllergyIntolerancesByPatient(patient);
  }

  getAllergyIntoleranceById(id: string): Observable<IAllergyIntolerance[]> {
    return this.AllergyIntoleranceApi.getById(id);
  }

  getAllergyIntolerancesByClinicalStatus(status: string): Observable<IAllergyIntolerance[]> {
    return this.AllergyIntoleranceApi.getAllergyIntolerancesByClinicalStatus(status);
  }

  getAllergyIntolerancesByType(type: string): Observable<IAllergyIntolerance[]> {
    return this.AllergyIntoleranceApi.getAllergyIntolerancesByType(type);
  }

  getAllergyIntolerancesByCategory(category: string): Observable<IAllergyIntolerance[]> {
    return this.AllergyIntoleranceApi.getAllergyIntolerancesByCategory(category);
  }

  getAllergyIntolerancesByCodeText(codeText: string): Observable<IAllergyIntolerance[]> {
    return this.AllergyIntoleranceApi.getAllergyIntolerancesByCodeText(codeText);
  }
}

Usage with MongoDB

See in the description of FhirApi: a link

The AllergyIntolerance 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 properties of AllergyIntolerance 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)