forked from lantanagroup/FHIR.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fhir.js
62 lines (62 loc) · 2.02 KB
/
fhir.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Fhir = exports.Versions = void 0;
const parseConformance_1 = require("./parseConformance");
const validator_1 = require("./validator");
const convertToJs_1 = require("./convertToJs");
const convertToXml_1 = require("./convertToXml");
const fhirPath_1 = require("./fhirPath");
const snapshotGenerator_1 = require("./snapshotGenerator");
var Versions;
(function (Versions) {
Versions["STU3"] = "STU3";
Versions["R4"] = "R4";
Versions["R5"] = "R5";
})(Versions = exports.Versions || (exports.Versions = {}));
class Fhir {
constructor(parser) {
this.parser = parser || new parseConformance_1.ParseConformance(true);
}
jsonToXml(json) {
const obj = JSON.parse(json);
return this.objToXml(obj);
}
objToXml(obj) {
const convertToXML = new convertToXml_1.ConvertToXml(this.parser);
const xml = convertToXML.convert(obj);
return xml;
}
;
xmlToObj(xml) {
const convertToJs = new convertToJs_1.ConvertToJs(this.parser);
const obj = convertToJs.convert(xml);
return obj;
}
;
xmlToJson(xml) {
const convertToJs = new convertToJs_1.ConvertToJs(this.parser);
const json = convertToJs.convertToJSON(xml);
return json;
}
;
validate(input, options) {
const validator = new validator_1.Validator(this.parser, options);
return validator.validate(input);
}
;
evaluate(resource, fhirPathString) {
const fhirPath = new fhirPath_1.FhirPath(resource, this.parser);
fhirPath.resolve = this.resolve;
return fhirPath.evaluate(fhirPathString);
}
;
resolve(reference) {
return;
}
generateSnapshot(bundle) {
const snapshotGenerator = new snapshotGenerator_1.SnapshotGenerator(this.parser, bundle);
snapshotGenerator.generate();
}
}
exports.Fhir = Fhir;
//# sourceMappingURL=fhir.js.map