@inclouded/fhir-questionnaireresponse
v2.0.0
Published
``` npm install --save @inclouded/fhir-questionnaireresponse ```
Downloads
28
Keywords
Readme
FHIR QuestionnaireResponse Firestore SDK
npm install --save @inclouded/fhir-questionnaireresponse
Introduction
In the repository the Firebase Cloud Firestore SDK can be found that was made for the FHIR QuestionnaireResponse 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 { QuestionnaireResponseApi } from '@inclouded/fhir-questionnaireresponse';
import { AngularFirestore } from '@angular/fire/firestore';
import { IQuestionnaireResponse } from '@ahryman40k/ts-fhir-types/lib/R4';
@Injectable()
export class QuestionnaireResponseService {
QuestionnaireResponseApi: QuestionnaireResponseApi;
constructor(private afs: AngularFirestore) {
this.QuestionnaireResponseApi = new QuestionnaireResponseApi(this.afs);
}
addQuestionnaireResponse(questionnaireresponse: IQuestionnaireResponse) {
return this.QuestionnaireResponseApi.add(questionnaireresponse);
}
getAllQuestionnaireResponses(): Observable<IQuestionnaireResponse[]> {
return this.QuestionnaireResponseApi.getAll();
}
deleteQuestionnaireResponse(questionnaireresponsebyId: string) {
return this.QuestionnaireResponseApi.delete(questionnaireresponsebyId);
}
updateQuestionnaireResponse(questionnaireresponse: IQuestionnaireResponse) {
return this.QuestionnaireResponseApi.update(questionnaireresponse);
}
getQuestionnaireResponseById(id: string) {
return this.QuestionnaireResponseApi.getById(id);
}
getQuestionnaireResponsesbyStatus(status: string): Observable<IQuestionnaireResponse[]> {
return this.QuestionnaireResponseApi.getQuestionnaireResponsesbyStatus(status);
}
getQuestionnaireResponsesbyBasedOn(basedOn: string): Observable<IQuestionnaireResponse[]> {
return this.QuestionnaireResponseApi.getQuestionnaireResponsesbyBasedOn(basedOn);
}
getQuestionnaireResponsesbyQuestionnaire(questionnaire: string): Observable<IQuestionnaireResponse[]> {
return this.QuestionnaireResponseApi.getQuestionnaireResponsesbyQuestionnaire(questionnaire);
}
getQuestionnaireResponsesbySubject(subject: string): Observable<IQuestionnaireResponse[]> {
return this.QuestionnaireResponseApi.getQuestionnaireResponsesbySubject(subject);
}
getQuestionnaireResponsesbyAuthor(author: string): Observable<IQuestionnaireResponse[]> {
return this.QuestionnaireResponseApi.getQuestionnaireResponsesbyAuthor(author);
}
getQuestionnaireResponsesbySource(source: string): Observable<IQuestionnaireResponse[]> {
return this.QuestionnaireResponseApi.getQuestionnaireResponsesbySource(source);
}
}
Usage with MongoDB
See in the description of FhirApi: a link
The QuestionnaireResponse 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 QuestionnaireResponse of Provenance that possess more complex objects build upon these.
Developer: Zoltán R. Jánki ([email protected]), Gábor Simon ([email protected])