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

# FHIR CarePlan Firestore SDK

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

## Introduction

In the repository the Firebase Cloud Firestore SDK can be found that was made for the FHIR CarePlan 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 { ICarePlan } from '@ahryman40k/ts-fhir-types/lib/R4';
import { AngularFirestore } from '@angular/fire/firestore';
import { ActivityCarePlanApi, BloodPressureCarePlanApi, GeneralCarePlanApi, WeightCarePlanApi, CarePlanApi
BloodGlucoseCarePlanApi, MedicationCarePlanApi } from '@inclouded/fhir-careplan';

@Injectable()
export class CarePlanService {
    ActivityCarePlanApi: ActivityCarePlanApi;
    BloodPressureCarePlanApi: BloodPressureCarePlanApi;
    GeneralCarePlanApi: GeneralCarePlanApi;
    WeightCarePlanApi: WeightCarePlanApi;
    MedicationCarePlanApi: MedicationCarePlanApi;
    BloodGlucoseCarePlanApi: BloodGlucoseCarePlanApi;
    CarePlanApi: CarePlanApi;

    constructor(private afs: AngularFirestore) {
        this.ActivityCarePlanApi = new ActivityCarePlanApi(this.afs);
        this.BloodPressureCarePlanApi = new BloodPressureCarePlanApi(this.afs);
        this.GeneralCarePlanApi = new GeneralCarePlanApi(this.afs);
        this.WeightCarePlanApi = new WeightCarePlanApi(this.afs);
        this.MedicationCarePlanApi = new MedicationCarePlanApi(this.afs);
        this.BloodGlucoseCarePlanApi = new BloodGlucoseCarePlanApi(this.afs);
        this.CarePlanApi = new CarePlanApi(this.afs);
    }

    addCarePlan(carePlan: ICarePlan) {
        return this.GeneralCarePlanApi.add(carePlan);
    }

    deleteCarePlan(carePlanId: string) {
        return this.GeneralCarePlanApi.delete(carePlanId);
    }

    updateCarePlan(carePlan: ICarePlan) {
        return this.GeneralCarePlanApi.update(carePlan);
    }

    getActivityCarePlanByBasedOn(basedOn: string) {
        return this.ActivityCarePlanApi.getCarePlanByBasedOn(basedOn);
    }

    getActivityCarePlanByCareTeam(careTeam: string) {
        return this.ActivityCarePlanApi.getCarePlanByCareTeam(careTeam);
    }

    getActivityCarePlanByGoal(goal: string) {
        return this.ActivityCarePlanApi.getCarePlanByGoal(goal);
    }

    getBloodPressureCarePlanByBasedOn(basedOn: string) {
        return this.BloodPressureCarePlanApi.getCarePlanByBasedOn(basedOn);
    }

    getBloodPressureCarePlanByCareTeam(careTeam: string) {
        return this.BloodPressureCarePlanApi.getCarePlanByCareTeam(careTeam);
    }

    getBloodPressureCarePlanByGoal(goal: string) {
        return this.BloodPressureCarePlanApi.getCarePlanByGoal(goal);
    }

    getGeneralCarePlanByBasedOn(basedOn: string) {
        return this.GeneralCarePlanApi.getCarePlanByBasedOn(basedOn);
    }

    getGeneralCarePlanByCareTeam(careTeam: string) {
        return this.GeneralCarePlanApi.getCarePlanByCareTeam(careTeam);
    }

    getGeneralCarePlanByGoal(goal: string) {
        return this.GeneralCarePlanApi.getCarePlanByGoal(goal);
    }

    getWeightCarePlanByBasedOn(basedOn: string) {
        return this.WeightCarePlanApi.getCarePlanByBasedOn(basedOn);
    }

    getWeightCarePlanByCareTeam(careTeam: string) {
        return this.WeightCarePlanApi.getCarePlanByCareTeam(careTeam);
    }

    getWeightCarePlanByGoal(goal: string) {
        return this.WeightCarePlanApi.getCarePlanByGoal(goal);
    }

    getActivityCarePlan() {
        return this.ActivityCarePlanApi.getAll();
    }

    getBloodPressureCarePlan() {
        return this.BloodPressureCarePlanApi.getAll();
    }

    getGeneralCarePlan() {
        return this.GeneralCarePlanApi.getAll();
    }

    getWeightCarePlan() {
        return this.WeightCarePlanApi.getAll();
    }

    getGeneralCarePlanBySubject(subject: string) {
        return this.GeneralCarePlanApi.getbySubject(subject);
    }

    getGeneralCarePlanBySubjectAndStatus(subject: string, status: string) {
        return this.GeneralCarePlanApi.getCarePlanByPatientAndStatus(subject, status);
    }

    getGeneralCarePlanByExpiration(dueDate: Date) {
        return this.GeneralCarePlanApi.getAllExpiringCarePlans(dueDate);
    }

    getGeneralCarePlanByExpirationAndPatient(subject: string, dueDate: Date) {
        return this.GeneralCarePlanApi.getAllExpiringCarePlansByPatient(subject, dueDate);
    }

    getActivityCarePlanBySubject(subject: string) {
        return this.ActivityCarePlanApi.getbySubject(subject);
    }

    getActivityCarePlanBySubjectAndStatus(subject: string, status: string) {
        return this.ActivityCarePlanApi.getCarePlanByPatientAndStatus(subject, status);
    }

    getBloodPressureCarePlanBySubject(subject: string) {
        return this.BloodPressureCarePlanApi.getbySubject(subject);
    }

    getBloodPressureCarePlanBySubjectAndStatus(subject: string, status: string) {
        return this.BloodPressureCarePlanApi.getCarePlanByPatientAndStatus(subject, status);
    }

    getWeightCarePlanBySubject(subject: string) {
        return this.WeightCarePlanApi.getbySubject(subject);
    }

    getWeightCarePlanBySubjectAndStatus(subject: string, status: string) {
        return this.WeightCarePlanApi.getCarePlanByPatientAndStatus(subject, status);
    }
}
```

## Usage with MongoDB

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

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