@inclouded/fhir-careplan
v3.0.0
Published
``` npm install --save @inclouded/fhir-careplan ```
Downloads
32
Keywords
Readme
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
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)
The SDK can be used in a Service in the following way:
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
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 ([email protected]), Gábor Simon ([email protected])