UNPKG

fhirbuilder

Version:
37 lines (36 loc) 1.74 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ObservationReferenceRangeValidator = ObservationReferenceRangeValidator; const definitions_1 = require("../base/definitions"); const base_1 = require("../base"); const utils_1 = require("../../../commons/utils"); const models_1 = require("../../../../r4/models"); /** * @description The model fields for the ObservationReferenceRange model */ const modelFields = (0, definitions_1.createBackboneDefinition)([ { name: 'low', type: 'Quantity', isArray: false, isRequired: false }, { name: 'high', type: 'Quantity', isArray: false, isRequired: false }, { name: 'type', type: 'CodeableConcept', isArray: false, isRequired: false }, { name: 'appliesTo', type: 'CodeableConcept', isArray: true, isRequired: false }, { name: 'age', type: 'Range', isArray: false, isRequired: false }, { name: 'text', type: 'string', isArray: false, isRequired: false }, { name: '_text', type: 'Element', isArray: false, isRequired: false }, ]); /** * @description Validates the ObservationReferenceRange model * @param dataToValidate - the ObservationReferenceRange model to validate * @param path - the path to the model * @param errors - the errors array */ function ObservationReferenceRangeValidator(dataToValidate, path = 'ObservationReferenceRange', errors = []) { // Ensure that the model fields match the attributes of the model (0, utils_1.AssertModelFieldsMatchAttributes)(modelFields, new models_1.ObservationReferenceRange()); // Validate the model and add any errors to the errors array (0, base_1.ModelValidator)({ dataToValidate, modelDefinition: modelFields, path, errors, }); }