@inclouded/fhir-auditevent
v2.0.0
Published
``` npm install --save @inclouded/fhir-auditevent ```
Downloads
29
Keywords
Readme
FHIR AuditEvent Firestore SDK
npm install --save @inclouded/fhir-auditevent
Introduction
In the repository the Firebase Cloud Firestore SDK can be found that was made for the FHIR AuditEvent 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 { AuditEventApi } from '@inclouded/fhir-auditevent';
import { IAuditEvent } from '@ahryman40k/ts-fhir-types/lib/R4';
import { AngularFirestore } from '@angular/fire/firestore';
@Injectable()
export class AuditEventService {
AuditEventApi: AuditEventApi;
constructor(private afs: AngularFirestore) {
this.AuditEventApi = new AuditEventApi(this.afs);
}
addAuditEvent(auditEvent: IAuditEvent) {
return this.AuditEventApi.add(auditEvent);
}
getAllAuditEvents(): Observable<IAuditEvent[]> {
return this.AuditEventApi.getAll();
}
deleteAuditEvent(auditEventId: string) {
return this.AuditEventApi.delete(auditEventId);
}
updateAuditEvent(auditEvent: IAuditEvent) {
return this.AuditEventApi.update(auditEvent);
}
getAuditEventById(id: string) {
return this.AuditEventApi.getById(id);
}
getAuditEventsByAgent(agentReference?: string, agentName?: string) {
return this.AuditEventApi.getAuditEventsByAgent(agentReference, agentName);
}
getAuditEventsByEntity(oldValue?: string, newValue?: string, description?: string) {
return this.AuditEventApi.getAuditEventsByEntity(oldValue, newValue, description);
}
getAuditEventsByEntityReference(entityReference?: string) {
return this.AuditEventApi.getAuditEventsByEntityReference(entityReference);
}
}
Usage with MongoDB
See in the description of FhirApi: a link
The AuditEvent 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 AuditEvent that possess more complex objects build upon these.
Developer: Zoltán R. Jánki ([email protected]), Gábor Simon ([email protected])