# @inclouded/fhir-medication

> ``` npm install --save @inclouded/fhir-medication ```

Latest version **3.0.0** (published 2021-01-26) · 0 weekly downloads

## Install

```sh
npm install @inclouded/fhir-medication
pnpm add @inclouded/fhir-medication
yarn add @inclouded/fhir-medication
bun add @inclouded/fhir-medication
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.0.0 |
| Published | 2021-01-26 |
| First published | 2019-08-30 |
| Weekly downloads | 0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 5 |
| Unpacked size | 134.9 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Maintainers | bilickiv, m2m-deploy, jankiz, grindy |

## Links

- npm: https://www.npmjs.com/package/@inclouded/fhir-medication
- npm.io page: https://npm.io/package/@inclouded/fhir-medication

## Dependencies (5)

- [tslib](https://npm.io/package/tslib.md) ^1.9.0
- [firebase](https://npm.io/package/firebase.md) ^6.4.2
- [@angular/fire](https://npm.io/package/@angular/fire.md) ^5.4.2
- [@inclouded/fhirapi](https://npm.io/package/@inclouded/fhirapi.md) ^3.0.0
- [@ahryman40k/ts-fhir-types](https://npm.io/package/@ahryman40k/ts-fhir-types.md) ^4.0.23

## Recent versions

- 3.0.0 (latest) — 2021-01-26
- 2.0.2 — 2020-04-14
- 2.0.1 — 2019-11-27
- 2.0.0 — 2019-11-25
- 1.0.5 — 2019-09-16
- 1.0.4 — 2019-09-05
- 1.0.2 — 2019-09-03
- 1.0.1 — 2019-08-30

## README

# FHIR Medication Firestore SDK

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

## Introduction

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

@Injectable()
export class MedicationService {

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

  getMedications(): Observable<IMedication[]> {
    return this.MedicationApi.getAll();
  }

  addMedication(medication: IMedication) {
    return this.MedicationApi.add(medication);
  }

  deleteMedication(medicationId: string) {
    return this.MedicationApi.delete(medicationId);
  }

  updateMedication(medication: IMedication) {
    return this.MedicationApi.update(medication);
  }

  getMedicationbyId(id: string): Observable<IMedication[]> {
    return this.MedicationApi.getById(id);
  }

  getMedicationByCode(code: string): Observable<IMedication[]> {
    return this.MedicationApi.getMedicationByCode(code);
  }

  getMedicationByStatus(status: string): Observable<IMedication[]> {
    return this.MedicationApi.getMedicationByStatus(status);
  }

  getMedicationByForm(form: string): Observable<IMedication[]> {
    return this.MedicationApi.getMedicationByForm(form);
  }

  getMedicationByBatch(batch: string): Observable<IMedication[]> {
    return this.MedicationApi.getMedicationByBatch(batch);
  }
}

```

## Usage with MongoDB

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

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

---
_Source: https://npm.io/package/@inclouded/fhir-medication · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
