npm package: @inclouded/fhir-medicationdispense
Description: ``` npm install --save @inclouded/fhir-medicationdispense ```
Latest version: 3.0.0

# FHIR MedicationDispense Firestore SDK

```
npm install --save @inclouded/fhir-medicationdispense
```

## Introduction

In the repository the Firebase Cloud Firestore SDK can be found that was made for the FHIR MedicationDispense 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:

```typescript
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { MedicationDispenseApi } from '@inclouded/fhir-medicationdispense';
import { AngularFirestore } from '@angular/fire/firestore';
import { IMedicationDispense } from '@ahryman40k/ts-fhir-types/lib/R4';

@Injectable()
export class MedicationDispenseService {

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

  getMedicationDispenses(): Observable<IMedicationDispense[]> {
    return this.MedicationDispenseApi.getAll();
  }

  addMedicationDispense(medicationdispense: MedicationDispense) {
    return this.MedicationDispenseApi.add(medicationdispense);
  }


  deleteMedicationDispense(medicationdispenseId: string) {
    return this.MedicationDispenseApi.delete(medicationdispenseId);
  }


  updateMedicationDispense(medicationdispense: MedicationDispense) {
    return this.MedicationDispenseApi.update(medicationdispense);
  }


  getMedicationDispensesbySubject(subject: string): Observable<IMedicationDispense[]> {
    return this.MedicationDispenseApi.getMedicationDispensesbySubject(subject);
  }

  getMedicationDispensebyId(id: string): Observable<IMedicationDispense> {
    return this.MedicationDispenseApi.getById(id);
  }

  getMedicationDispensesbyStatus(status: string): Observable<IMedicationDispense[]> {
    return this.MedicationDispenseApi.getMedicationDispensesbyStatus(status);
  }

  getMedicationDispensesbyMedicationReference(medicationReference: string): Observable<IMedicationDispense[]> {
    return this.MedicationDispenseApi.getMedicationDispensesbyMedicationReference(medicationReference);
  }

  getMedicationDispensesbyPerformer(performer: string): Observable<IMedicationDispense[]> {
    return this.MedicationDispenseApi.getMedicationDispensesbyPerformer(performer);
  }

  getMedicationDispensesbyAuthorizingPrescription(authorizingPrescription: string): Observable<IMedicationDispense[]> {
    return this.MedicationDispenseApi.getMedicationDispensesbyAuthorizingPrescription(authorizingPrescription);
  }
}

```

## Usage with MongoDB

See in the description of FhirApi:
[a link](https://www.npmjs.com/package/@inclouded/fhirapi)

> The MedicationDispense 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 MedicationDispense 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)