#7914 - Fix for contacts being empty or s tring (#7915)
[openemr.git] / src / FHIR / R4 / FHIRElement / FHIRSampledData.php
blob3d1fb3d45135d81442742136a4b5399f3222bfbf
1 <?php
3 namespace OpenEMR\FHIR\R4\FHIRElement;
5 /*!
6 * This class was generated with the PHPFHIR library (https://github.com/dcarbone/php-fhir) using
7 * class definitions from HL7 FHIR (https://www.hl7.org/fhir/)
9 * Class creation date: June 14th, 2019
11 * PHPFHIR Copyright:
13 * Copyright 2016-2017 Daniel Carbone (daniel.p.carbone@gmail.com)
15 * Licensed under the Apache License, Version 2.0 (the "License");
16 * you may not use this file except in compliance with the License.
17 * You may obtain a copy of the License at
19 * http://www.apache.org/licenses/LICENSE-2.0
21 * Unless required by applicable law or agreed to in writing, software
22 * distributed under the License is distributed on an "AS IS" BASIS,
23 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
24 * See the License for the specific language governing permissions and
25 * limitations under the License.
28 * FHIR Copyright Notice:
30 * Copyright (c) 2011+, HL7, Inc.
31 * All rights reserved.
33 * Redistribution and use in source and binary forms, with or without modification,
34 * are permitted provided that the following conditions are met:
36 * * Redistributions of source code must retain the above copyright notice, this
37 * list of conditions and the following disclaimer.
38 * * Redistributions in binary form must reproduce the above copyright notice,
39 * this list of conditions and the following disclaimer in the documentation
40 * and/or other materials provided with the distribution.
41 * * Neither the name of HL7 nor the names of its contributors may be used to
42 * endorse or promote products derived from this software without specific
43 * prior written permission.
45 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
46 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
47 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
48 * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
49 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
50 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
51 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
52 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
53 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
54 * POSSIBILITY OF SUCH DAMAGE.
57 * Generated on Thu, Dec 27, 2018 22:37+1100 for FHIR v4.0.0
59 * Note: the schemas & schematrons do not contain all of the rules about what makes resources
60 * valid. Implementers will still need to be familiar with the content of the specification and with
61 * any profiles that apply to the resources in order to make a conformant implementation.
65 use OpenEMR\FHIR\R4\FHIRElement;
67 /**
68 * A series of measurements taken by a device, with upper and lower limits. There may be more than one dimension in the data.
69 * If the element is present, it must have a value for at least one of the defined elements, an @id referenced from the Narrative, or extensions
71 class FHIRSampledData extends FHIRElement implements \JsonSerializable
73 /**
74 * The base quantity that a measured value of zero represents. In addition, this provides the units of the entire measurement series.
75 * @var \OpenEMR\FHIR\R4\FHIRElement\FHIRQuantity
77 public $origin = null;
79 /**
80 * The length of time between sampling times, measured in milliseconds.
81 * @var \OpenEMR\FHIR\R4\FHIRElement\FHIRDecimal
83 public $period = null;
85 /**
86 * A correction factor that is applied to the sampled data points before they are added to the origin.
87 * @var \OpenEMR\FHIR\R4\FHIRElement\FHIRDecimal
89 public $factor = null;
91 /**
92 * The lower limit of detection of the measured points. This is needed if any of the data points have the value "L" (lower than detection limit).
93 * @var \OpenEMR\FHIR\R4\FHIRElement\FHIRDecimal
95 public $lowerLimit = null;
97 /**
98 * The upper limit of detection of the measured points. This is needed if any of the data points have the value "U" (higher than detection limit).
99 * @var \OpenEMR\FHIR\R4\FHIRElement\FHIRDecimal
101 public $upperLimit = null;
104 * The number of sample points at each time point. If this value is greater than one, then the dimensions will be interlaced - all the sample points for a point in time will be recorded at once.
105 * @var \OpenEMR\FHIR\R4\FHIRElement\FHIRPositiveInt
107 public $dimensions = null;
110 * A series of data points which are decimal values separated by a single space (character u20). The special values "E" (error), "L" (below detection limit) and "U" (above detection limit) can also be used in place of a decimal value.
111 * @var \OpenEMR\FHIR\R4\FHIRElement\FHIRSampledDataDataType
113 public $data = null;
116 * @var string
118 private $_fhirElementName = 'SampledData';
121 * The base quantity that a measured value of zero represents. In addition, this provides the units of the entire measurement series.
122 * @return \OpenEMR\FHIR\R4\FHIRElement\FHIRQuantity
124 public function getOrigin()
126 return $this->origin;
130 * The base quantity that a measured value of zero represents. In addition, this provides the units of the entire measurement series.
131 * @param \OpenEMR\FHIR\R4\FHIRElement\FHIRQuantity $origin
132 * @return $this
134 public function setOrigin($origin)
136 $this->origin = $origin;
137 return $this;
141 * The length of time between sampling times, measured in milliseconds.
142 * @return \OpenEMR\FHIR\R4\FHIRElement\FHIRDecimal
144 public function getPeriod()
146 return $this->period;
150 * The length of time between sampling times, measured in milliseconds.
151 * @param \OpenEMR\FHIR\R4\FHIRElement\FHIRDecimal $period
152 * @return $this
154 public function setPeriod($period)
156 $this->period = $period;
157 return $this;
161 * A correction factor that is applied to the sampled data points before they are added to the origin.
162 * @return \OpenEMR\FHIR\R4\FHIRElement\FHIRDecimal
164 public function getFactor()
166 return $this->factor;
170 * A correction factor that is applied to the sampled data points before they are added to the origin.
171 * @param \OpenEMR\FHIR\R4\FHIRElement\FHIRDecimal $factor
172 * @return $this
174 public function setFactor($factor)
176 $this->factor = $factor;
177 return $this;
181 * The lower limit of detection of the measured points. This is needed if any of the data points have the value "L" (lower than detection limit).
182 * @return \OpenEMR\FHIR\R4\FHIRElement\FHIRDecimal
184 public function getLowerLimit()
186 return $this->lowerLimit;
190 * The lower limit of detection of the measured points. This is needed if any of the data points have the value "L" (lower than detection limit).
191 * @param \OpenEMR\FHIR\R4\FHIRElement\FHIRDecimal $lowerLimit
192 * @return $this
194 public function setLowerLimit($lowerLimit)
196 $this->lowerLimit = $lowerLimit;
197 return $this;
201 * The upper limit of detection of the measured points. This is needed if any of the data points have the value "U" (higher than detection limit).
202 * @return \OpenEMR\FHIR\R4\FHIRElement\FHIRDecimal
204 public function getUpperLimit()
206 return $this->upperLimit;
210 * The upper limit of detection of the measured points. This is needed if any of the data points have the value "U" (higher than detection limit).
211 * @param \OpenEMR\FHIR\R4\FHIRElement\FHIRDecimal $upperLimit
212 * @return $this
214 public function setUpperLimit($upperLimit)
216 $this->upperLimit = $upperLimit;
217 return $this;
221 * The number of sample points at each time point. If this value is greater than one, then the dimensions will be interlaced - all the sample points for a point in time will be recorded at once.
222 * @return \OpenEMR\FHIR\R4\FHIRElement\FHIRPositiveInt
224 public function getDimensions()
226 return $this->dimensions;
230 * The number of sample points at each time point. If this value is greater than one, then the dimensions will be interlaced - all the sample points for a point in time will be recorded at once.
231 * @param \OpenEMR\FHIR\R4\FHIRElement\FHIRPositiveInt $dimensions
232 * @return $this
234 public function setDimensions($dimensions)
236 $this->dimensions = $dimensions;
237 return $this;
241 * A series of data points which are decimal values separated by a single space (character u20). The special values "E" (error), "L" (below detection limit) and "U" (above detection limit) can also be used in place of a decimal value.
242 * @return \OpenEMR\FHIR\R4\FHIRElement\FHIRSampledDataDataType
244 public function getData()
246 return $this->data;
250 * A series of data points which are decimal values separated by a single space (character u20). The special values "E" (error), "L" (below detection limit) and "U" (above detection limit) can also be used in place of a decimal value.
251 * @param \OpenEMR\FHIR\R4\FHIRElement\FHIRSampledDataDataType $data
252 * @return $this
254 public function setData($data)
256 $this->data = $data;
257 return $this;
261 * @return string
263 public function get_fhirElementName()
265 return $this->_fhirElementName;
269 * @param mixed $data
271 public function __construct($data = [])
273 if (is_array($data)) {
274 if (isset($data['origin'])) {
275 $this->setOrigin($data['origin']);
277 if (isset($data['period'])) {
278 $this->setPeriod($data['period']);
280 if (isset($data['factor'])) {
281 $this->setFactor($data['factor']);
283 if (isset($data['lowerLimit'])) {
284 $this->setLowerLimit($data['lowerLimit']);
286 if (isset($data['upperLimit'])) {
287 $this->setUpperLimit($data['upperLimit']);
289 if (isset($data['dimensions'])) {
290 $this->setDimensions($data['dimensions']);
292 if (isset($data['data'])) {
293 $this->setData($data['data']);
295 } elseif (null !== $data) {
296 throw new \InvalidArgumentException('$data expected to be array of values, saw "' . gettype($data) . '"');
298 parent::__construct($data);
302 * @return string
304 public function __toString()
306 return $this->get_fhirElementName();
310 * @return array
312 public function jsonSerialize(): mixed
314 $json = parent::jsonSerialize();
315 if (isset($this->origin)) {
316 $json['origin'] = $this->origin;
318 if (isset($this->period)) {
319 $json['period'] = $this->period;
321 if (isset($this->factor)) {
322 $json['factor'] = $this->factor;
324 if (isset($this->lowerLimit)) {
325 $json['lowerLimit'] = $this->lowerLimit;
327 if (isset($this->upperLimit)) {
328 $json['upperLimit'] = $this->upperLimit;
330 if (isset($this->dimensions)) {
331 $json['dimensions'] = $this->dimensions;
333 if (isset($this->data)) {
334 $json['data'] = $this->data;
336 return $json;
340 * @param boolean $returnSXE
341 * @param \SimpleXMLElement $sxe
342 * @return string|\SimpleXMLElement
344 public function xmlSerialize($returnSXE = false, $sxe = null)
346 if (null === $sxe) {
347 $sxe = new \SimpleXMLElement('<SampledData xmlns="http://hl7.org/fhir"></SampledData>');
349 parent::xmlSerialize(true, $sxe);
350 if (isset($this->origin)) {
351 $this->origin->xmlSerialize(true, $sxe->addChild('origin'));
353 if (isset($this->period)) {
354 $this->period->xmlSerialize(true, $sxe->addChild('period'));
356 if (isset($this->factor)) {
357 $this->factor->xmlSerialize(true, $sxe->addChild('factor'));
359 if (isset($this->lowerLimit)) {
360 $this->lowerLimit->xmlSerialize(true, $sxe->addChild('lowerLimit'));
362 if (isset($this->upperLimit)) {
363 $this->upperLimit->xmlSerialize(true, $sxe->addChild('upperLimit'));
365 if (isset($this->dimensions)) {
366 $this->dimensions->xmlSerialize(true, $sxe->addChild('dimensions'));
368 if (isset($this->data)) {
369 $this->data->xmlSerialize(true, $sxe->addChild('data'));
371 if ($returnSXE) {
372 return $sxe;
374 return $sxe->saveXML();