fhirbuilder
Version:
Another FHIR Tool to build FHIR Resources
39 lines (38 loc) • 1.58 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ProcedurePerformerValidator = ProcedurePerformerValidator;
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 ProcedurePerformer model
*/
const modelFields = (0, definitions_1.createBackboneDefinition)([
{ name: 'function', type: 'CodeableConcept', isArray: false, isRequired: false },
{
name: 'actor',
type: 'Reference',
isArray: false,
isRequired: true,
referenceTypes: ['Practitioner', 'PractitionerRole', 'Organization', 'Patient', 'Device', 'RelatedPerson'],
},
{ name: 'onBehalfOf', type: 'Reference', isArray: false, isRequired: false, referenceTypes: ['Organization'] },
]);
/**
* @description Validates the ProcedurePerformer model
* @param dataToValidate - the ProcedurePerformer model to validate
* @param path - the path to the model
* @param errors - the errors array
*/
function ProcedurePerformerValidator(dataToValidate, path = 'ProcedurePerformer', errors = []) {
// Ensure that the model fields match the attributes of the model
(0, utils_1.AssertModelFieldsMatchAttributes)(modelFields, new models_1.ProcedurePerformer());
// Validate the model and add any errors to the errors array
(0, base_1.ModelValidator)({
dataToValidate,
modelDefinition: modelFields,
path,
errors,
});
}