@inclouded/fhir-communication
v2.0.0
Published
``` npm install --save @inclouded/fhir-communication ```
Downloads
25
Keywords
Readme
FHIR Communication Firestore SDK
npm install --save @inclouded/fhir-communication
Introduction
In the repository the Firebase Cloud Firestore SDK can be found that was made for the FHIR Communication 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 { Observable } from 'rxjs';
import { CommunicationApi } from '@inclouded/fhir-communication';
import { AngularFirestore } from '@angular/fire/firestore';
import { ICommunication } from '@ahryman40k/ts-fhir-types/lib/R4';
@Injectable()
export class CommunicationService {
CommunicationApi: CommunicationApi;
constructor(private afs: AngularFirestore) {
this.CommunicationApi = new CommunicationApi(this.afs);
}
getCommunications(): Observable<ICommunication[]> {
return this.CommunicationApi.getAll();
}
addCommunication(communication: ICommunication) {
return this.CommunicationApi.add(communication);
}
deleteCommunication(communicationId: string) {
return this.CommunicationApi.delete(communicationId);
}
updateCommunication(communication: ICommunication) {
return this.CommunicationApi.update(communication);
}
getCommunicationsbyReasonReference(reasonReference: string): Observable<ICommunication[]> {
return this.CommunicationApi.getCommunicationsbyReasonReference(reasonReference);
}
getCommunicationById(id: string): Observable<ICommunication[]> {
return this.CommunicationApi.getById(id);
}
getCommunicationByPatient(patinent: string): Observable<ICommunication[]> {
return this.CommunicationApi.getCommunicationByPatient(patinent);
}
getCommunicationByDate(dateStart: Date, dateEnd: Date): Observable<ICommunication[]> {
return this.CommunicationApi.getCommunicationByDate(dateStart, dateEnd);
}
getCommunicationByStatus(status: string): Observable<ICommunication[]> {
return this.CommunicationApi.getCommunicationByStatus(status);
}
getCommunicationByBasedOn(basedOn: string): Observable<ICommunication[]> {
return this.CommunicationApi.getCommunicationByBasedOn(basedOn);
}
getCommunicationByCategory(category: string): Observable<ICommunication[]> {
return this.CommunicationApi.getCommunicationByCategory(category);
}
getCommunicationByEncounter(encounter: string): Observable<ICommunication[]> {
return this.CommunicationApi.getCommunicationByEncounter(encounter);
}
getCommunicationByReceived(received: Date): Observable<ICommunication[]> {
return this.CommunicationApi.getCommunicationByReceived(received);
}
getCommunicationByPatientAndPriority(patient: string, priority: string): Observable<ICommunication[]> {
return this.CommunicationApi.getCommunicationByPatientAndPriority(patient, priority);
}
}
Usage with MongoDB
See in the description of FhirApi: a link
The Communication 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 Communication that possess more complex objects build upon these.
Developer: Zoltán R. Jánki ([email protected]), Gábor Simon ([email protected])