UNPKG

fhirbuilder

Version:
193 lines (192 loc) 6.96 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ObservationComponentBuilder = void 0; const models_1 = require("../../models"); const base_1 = require("../base"); /** * @version R4 (v4.0.1) * @summary FHIR® Specification by HL7® * @description Class for building a ObservationComponent * @class ObservationComponentBuilder * @extends {BackboneBuilder} * @implements {IObservationComponentBuilder} * @author Roberto Araneda Espinoza */ class ObservationComponentBuilder extends base_1.BackboneBuilder { observationComponent; constructor() { super(); this.observationComponent = new models_1.ObservationComponent(); } /** * @description Adds a primitive extension to the element * @param param - the field to add the extension to * @param extension - the extension to add * @returns {this} * @example addPrimitiveExtension('_value', { value: 'test' }) */ addPrimitiveExtension(param, extension) { this.observationComponent[param] = extension; return this; } /** * @description Builds the model * @returns {ObservationComponent} */ build() { return Object.assign(this.observationComponent, super.build()); } /** * @description Sets the code value * @description Describes what was observed. Sometimes this is called the observation "code". * @param value - the value to set * @returns {this} */ setCode(value) { this.observationComponent.code = value; return this; } /** * @description Sets the valueQuantity value * @description The information determined as a result of making the observation, if the information has a simple value. * @param value - the value to set * @returns {this} */ setValueQuantity(value) { this.observationComponent.valueQuantity = value; return this; } /** * @description Sets the valueCodeableConcept value * @description The information determined as a result of making the observation, if the information has a simple value. * @param value - the value to set * @returns {this} */ setValueCodeableConcept(value) { this.observationComponent.valueCodeableConcept = value; return this; } /** * @description Sets the valueString value * @description The information determined as a result of making the observation, if the information has a simple value. * @param value - the value to set * @returns {this} */ setValueString(value) { this.observationComponent.valueString = value; return this; } /** * @description Sets the valueBoolean value * @description The information determined as a result of making the observation, if the information has a simple value. * @param value - the value to set * @returns {this} */ setValueBoolean(value) { this.observationComponent.valueBoolean = value; return this; } /** * @description Sets the valueInteger value * @description The information determined as a result of making the observation, if the information has a simple value. * @param value - the value to set * @returns {this} */ setValueInteger(value) { this.observationComponent.valueInteger = value; return this; } /** * @description Sets the valueRange value * @description The information determined as a result of making the observation, if the information has a simple value. * @param value - the value to set * @returns {this} */ setValueRange(value) { this.observationComponent.valueRange = value; return this; } /** * @description Sets the valueRatio value * @description The information determined as a result of making the observation, if the information has a simple value. * @param value - the value to set * @returns {this} */ setValueRatio(value) { this.observationComponent.valueRatio = value; return this; } /** * @description Sets the valueSampledData value * @description The information determined as a result of making the observation, if the information has a simple value. * @param value - the value to set * @returns {this} */ setValueSampledData(value) { this.observationComponent.valueSampledData = value; return this; } /** * @description Sets the valueTime value * @description The information determined as a result of making the observation, if the information has a simple value. * @param value - the value to set * @returns {this} */ setValueTime(value) { this.observationComponent.valueTime = value; return this; } /** * @description Sets the valueDateTime value * @description The information determined as a result of making the observation, if the information has a simple value. * @param value - the value to set * @returns {this} */ setValueDateTime(value) { this.observationComponent.valueDateTime = value; return this; } /** * @description Sets the valuePeriod value * @description The information determined as a result of making the observation, if the information has a simple value. * @param value - the value to set * @returns {this} */ setValuePeriod(value) { this.observationComponent.valuePeriod = value; return this; } /** * @description Sets the dataAbsentReason value * @description Provides a reason why the expected value in the element Observation.component.value[x] is missing. * @param value - the value to set * @returns {this} */ setDataAbsentReason(value) { this.observationComponent.dataAbsentReason = value; return this; } /** * @description Adds a value to the interpretation array * @description A categorical assessment of an observation value. For example, high, low, normal. * @param value - the value to add * @returns {this} */ addInterpretation(value) { this.observationComponent.interpretation = this.observationComponent.interpretation || []; this.observationComponent.interpretation.push(value); return this; } /** * @description Adds a value to the referenceRange array * @description Guidance on how to interpret the value by comparison to a normal or recommended range. * @param value - the value to add * @returns {this} */ addReferenceRange(value) { this.observationComponent.referenceRange = this.observationComponent.referenceRange || []; this.observationComponent.referenceRange.push(value); return this; } } exports.ObservationComponentBuilder = ObservationComponentBuilder;