fhirbuilder
Version:
Another FHIR Tool to build FHIR Resources
57 lines (56 loc) • 1.98 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.CarePlanActivityValidator = CarePlanActivityValidator;
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 CarePlanActivity model
*/
const modelFields = (0, definitions_1.createBackboneDefinition)([
{ name: 'outcomeCodeableConcept', type: 'CodeableConcept', isArray: true, isRequired: false },
{
name: 'outcomeReference',
type: 'Reference',
isArray: true,
isRequired: false,
referenceTypes: ['Any'],
},
{ name: 'progress', type: 'Annotation', isArray: true, isRequired: false },
{
name: 'reference',
type: 'Reference',
isArray: false,
isRequired: false,
referenceTypes: [
'Appointment',
'CommunicationRequest',
'DeviceRequest',
'MedicationRequest',
'NutritionOrder',
'Task',
'ServiceRequest',
'VisionPrescription',
'RequestGroup',
],
},
{ name: 'detail', type: 'CarePlanDetail', isArray: false, isRequired: false },
]);
/**
* @description Validates the CarePlanActivity model
* @param dataToValidate - the CarePlanActivity model to validate
* @param path - the path to the model
* @param errors - the errors array
*/
function CarePlanActivityValidator(dataToValidate, path = 'CarePlanActivity', errors = []) {
// Ensure that the model fields match the attributes of the model
(0, utils_1.AssertModelFieldsMatchAttributes)(modelFields, new models_1.CarePlanActivity());
// Validate the model and add any errors to the errors array
(0, base_1.ModelValidator)({
dataToValidate,
modelDefinition: modelFields,
path,
errors,
});
}