001package org.hl7.fhir.dstu2.model; 002 003 004 005 006/* 007 Copyright (c) 2011+, HL7, Inc. 008 All rights reserved. 009 010 Redistribution and use in source and binary forms, with or without modification, 011 are permitted provided that the following conditions are met: 012 013 * Redistributions of source code must retain the above copyright notice, this 014 list of conditions and the following disclaimer. 015 * Redistributions in binary form must reproduce the above copyright notice, 016 this list of conditions and the following disclaimer in the documentation 017 and/or other materials provided with the distribution. 018 * Neither the name of HL7 nor the names of its contributors may be used to 019 endorse or promote products derived from this software without specific 020 prior written permission. 021 022 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 023 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 024 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 025 IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 026 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 027 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 028 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 029 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 030 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 031 POSSIBILITY OF SUCH DAMAGE. 032 033*/ 034 035// Generated on Wed, Jul 13, 2016 05:32+1000 for FHIR v1.0.2 036import java.util.ArrayList; 037import java.util.Date; 038import java.util.List; 039 040import ca.uhn.fhir.model.api.annotation.Block; 041import ca.uhn.fhir.model.api.annotation.Child; 042import ca.uhn.fhir.model.api.annotation.Description; 043import ca.uhn.fhir.model.api.annotation.ResourceDef; 044import ca.uhn.fhir.model.api.annotation.SearchParamDefinition; 045import org.hl7.fhir.instance.model.api.IBaseBackboneElement; 046import org.hl7.fhir.exceptions.FHIRException; 047/** 048 * Describes a measurement, calculation or setting capability of a medical device. 049 */ 050@ResourceDef(name="DeviceMetric", profile="http://hl7.org/fhir/Profile/DeviceMetric") 051public class DeviceMetric extends DomainResource { 052 053 public enum DeviceMetricOperationalStatus { 054 /** 055 * The DeviceMetric is operating and will generate DeviceObservations. 056 */ 057 ON, 058 /** 059 * The DeviceMetric is not operating. 060 */ 061 OFF, 062 /** 063 * The DeviceMetric is operating, but will not generate any DeviceObservations. 064 */ 065 STANDBY, 066 /** 067 * added to help the parsers 068 */ 069 NULL; 070 public static DeviceMetricOperationalStatus fromCode(String codeString) throws FHIRException { 071 if (codeString == null || "".equals(codeString)) 072 return null; 073 if ("on".equals(codeString)) 074 return ON; 075 if ("off".equals(codeString)) 076 return OFF; 077 if ("standby".equals(codeString)) 078 return STANDBY; 079 throw new FHIRException("Unknown DeviceMetricOperationalStatus code '"+codeString+"'"); 080 } 081 public String toCode() { 082 switch (this) { 083 case ON: return "on"; 084 case OFF: return "off"; 085 case STANDBY: return "standby"; 086 case NULL: return null; 087 default: return "?"; 088 } 089 } 090 public String getSystem() { 091 switch (this) { 092 case ON: return "http://hl7.org/fhir/metric-operational-status"; 093 case OFF: return "http://hl7.org/fhir/metric-operational-status"; 094 case STANDBY: return "http://hl7.org/fhir/metric-operational-status"; 095 case NULL: return null; 096 default: return "?"; 097 } 098 } 099 public String getDefinition() { 100 switch (this) { 101 case ON: return "The DeviceMetric is operating and will generate DeviceObservations."; 102 case OFF: return "The DeviceMetric is not operating."; 103 case STANDBY: return "The DeviceMetric is operating, but will not generate any DeviceObservations."; 104 case NULL: return null; 105 default: return "?"; 106 } 107 } 108 public String getDisplay() { 109 switch (this) { 110 case ON: return "On"; 111 case OFF: return "Off"; 112 case STANDBY: return "Standby"; 113 case NULL: return null; 114 default: return "?"; 115 } 116 } 117 } 118 119 public static class DeviceMetricOperationalStatusEnumFactory implements EnumFactory<DeviceMetricOperationalStatus> { 120 public DeviceMetricOperationalStatus fromCode(String codeString) throws IllegalArgumentException { 121 if (codeString == null || "".equals(codeString)) 122 if (codeString == null || "".equals(codeString)) 123 return null; 124 if ("on".equals(codeString)) 125 return DeviceMetricOperationalStatus.ON; 126 if ("off".equals(codeString)) 127 return DeviceMetricOperationalStatus.OFF; 128 if ("standby".equals(codeString)) 129 return DeviceMetricOperationalStatus.STANDBY; 130 throw new IllegalArgumentException("Unknown DeviceMetricOperationalStatus code '"+codeString+"'"); 131 } 132 public Enumeration<DeviceMetricOperationalStatus> fromType(Base code) throws FHIRException { 133 if (code == null || code.isEmpty()) 134 return null; 135 String codeString = ((PrimitiveType) code).asStringValue(); 136 if (codeString == null || "".equals(codeString)) 137 return null; 138 if ("on".equals(codeString)) 139 return new Enumeration<DeviceMetricOperationalStatus>(this, DeviceMetricOperationalStatus.ON); 140 if ("off".equals(codeString)) 141 return new Enumeration<DeviceMetricOperationalStatus>(this, DeviceMetricOperationalStatus.OFF); 142 if ("standby".equals(codeString)) 143 return new Enumeration<DeviceMetricOperationalStatus>(this, DeviceMetricOperationalStatus.STANDBY); 144 throw new FHIRException("Unknown DeviceMetricOperationalStatus code '"+codeString+"'"); 145 } 146 public String toCode(DeviceMetricOperationalStatus code) { 147 if (code == DeviceMetricOperationalStatus.ON) 148 return "on"; 149 if (code == DeviceMetricOperationalStatus.OFF) 150 return "off"; 151 if (code == DeviceMetricOperationalStatus.STANDBY) 152 return "standby"; 153 return "?"; 154 } 155 } 156 157 public enum DeviceMetricColor { 158 /** 159 * Color for representation - black. 160 */ 161 BLACK, 162 /** 163 * Color for representation - red. 164 */ 165 RED, 166 /** 167 * Color for representation - green. 168 */ 169 GREEN, 170 /** 171 * Color for representation - yellow. 172 */ 173 YELLOW, 174 /** 175 * Color for representation - blue. 176 */ 177 BLUE, 178 /** 179 * Color for representation - magenta. 180 */ 181 MAGENTA, 182 /** 183 * Color for representation - cyan. 184 */ 185 CYAN, 186 /** 187 * Color for representation - white. 188 */ 189 WHITE, 190 /** 191 * added to help the parsers 192 */ 193 NULL; 194 public static DeviceMetricColor fromCode(String codeString) throws FHIRException { 195 if (codeString == null || "".equals(codeString)) 196 return null; 197 if ("black".equals(codeString)) 198 return BLACK; 199 if ("red".equals(codeString)) 200 return RED; 201 if ("green".equals(codeString)) 202 return GREEN; 203 if ("yellow".equals(codeString)) 204 return YELLOW; 205 if ("blue".equals(codeString)) 206 return BLUE; 207 if ("magenta".equals(codeString)) 208 return MAGENTA; 209 if ("cyan".equals(codeString)) 210 return CYAN; 211 if ("white".equals(codeString)) 212 return WHITE; 213 throw new FHIRException("Unknown DeviceMetricColor code '"+codeString+"'"); 214 } 215 public String toCode() { 216 switch (this) { 217 case BLACK: return "black"; 218 case RED: return "red"; 219 case GREEN: return "green"; 220 case YELLOW: return "yellow"; 221 case BLUE: return "blue"; 222 case MAGENTA: return "magenta"; 223 case CYAN: return "cyan"; 224 case WHITE: return "white"; 225 case NULL: return null; 226 default: return "?"; 227 } 228 } 229 public String getSystem() { 230 switch (this) { 231 case BLACK: return "http://hl7.org/fhir/metric-color"; 232 case RED: return "http://hl7.org/fhir/metric-color"; 233 case GREEN: return "http://hl7.org/fhir/metric-color"; 234 case YELLOW: return "http://hl7.org/fhir/metric-color"; 235 case BLUE: return "http://hl7.org/fhir/metric-color"; 236 case MAGENTA: return "http://hl7.org/fhir/metric-color"; 237 case CYAN: return "http://hl7.org/fhir/metric-color"; 238 case WHITE: return "http://hl7.org/fhir/metric-color"; 239 case NULL: return null; 240 default: return "?"; 241 } 242 } 243 public String getDefinition() { 244 switch (this) { 245 case BLACK: return "Color for representation - black."; 246 case RED: return "Color for representation - red."; 247 case GREEN: return "Color for representation - green."; 248 case YELLOW: return "Color for representation - yellow."; 249 case BLUE: return "Color for representation - blue."; 250 case MAGENTA: return "Color for representation - magenta."; 251 case CYAN: return "Color for representation - cyan."; 252 case WHITE: return "Color for representation - white."; 253 case NULL: return null; 254 default: return "?"; 255 } 256 } 257 public String getDisplay() { 258 switch (this) { 259 case BLACK: return "Color Black"; 260 case RED: return "Color Red"; 261 case GREEN: return "Color Green"; 262 case YELLOW: return "Color Yellow"; 263 case BLUE: return "Color Blue"; 264 case MAGENTA: return "Color Magenta"; 265 case CYAN: return "Color Cyan"; 266 case WHITE: return "Color White"; 267 case NULL: return null; 268 default: return "?"; 269 } 270 } 271 } 272 273 public static class DeviceMetricColorEnumFactory implements EnumFactory<DeviceMetricColor> { 274 public DeviceMetricColor fromCode(String codeString) throws IllegalArgumentException { 275 if (codeString == null || "".equals(codeString)) 276 if (codeString == null || "".equals(codeString)) 277 return null; 278 if ("black".equals(codeString)) 279 return DeviceMetricColor.BLACK; 280 if ("red".equals(codeString)) 281 return DeviceMetricColor.RED; 282 if ("green".equals(codeString)) 283 return DeviceMetricColor.GREEN; 284 if ("yellow".equals(codeString)) 285 return DeviceMetricColor.YELLOW; 286 if ("blue".equals(codeString)) 287 return DeviceMetricColor.BLUE; 288 if ("magenta".equals(codeString)) 289 return DeviceMetricColor.MAGENTA; 290 if ("cyan".equals(codeString)) 291 return DeviceMetricColor.CYAN; 292 if ("white".equals(codeString)) 293 return DeviceMetricColor.WHITE; 294 throw new IllegalArgumentException("Unknown DeviceMetricColor code '"+codeString+"'"); 295 } 296 public Enumeration<DeviceMetricColor> fromType(Base code) throws FHIRException { 297 if (code == null || code.isEmpty()) 298 return null; 299 String codeString = ((PrimitiveType) code).asStringValue(); 300 if (codeString == null || "".equals(codeString)) 301 return null; 302 if ("black".equals(codeString)) 303 return new Enumeration<DeviceMetricColor>(this, DeviceMetricColor.BLACK); 304 if ("red".equals(codeString)) 305 return new Enumeration<DeviceMetricColor>(this, DeviceMetricColor.RED); 306 if ("green".equals(codeString)) 307 return new Enumeration<DeviceMetricColor>(this, DeviceMetricColor.GREEN); 308 if ("yellow".equals(codeString)) 309 return new Enumeration<DeviceMetricColor>(this, DeviceMetricColor.YELLOW); 310 if ("blue".equals(codeString)) 311 return new Enumeration<DeviceMetricColor>(this, DeviceMetricColor.BLUE); 312 if ("magenta".equals(codeString)) 313 return new Enumeration<DeviceMetricColor>(this, DeviceMetricColor.MAGENTA); 314 if ("cyan".equals(codeString)) 315 return new Enumeration<DeviceMetricColor>(this, DeviceMetricColor.CYAN); 316 if ("white".equals(codeString)) 317 return new Enumeration<DeviceMetricColor>(this, DeviceMetricColor.WHITE); 318 throw new FHIRException("Unknown DeviceMetricColor code '"+codeString+"'"); 319 } 320 public String toCode(DeviceMetricColor code) { 321 if (code == DeviceMetricColor.BLACK) 322 return "black"; 323 if (code == DeviceMetricColor.RED) 324 return "red"; 325 if (code == DeviceMetricColor.GREEN) 326 return "green"; 327 if (code == DeviceMetricColor.YELLOW) 328 return "yellow"; 329 if (code == DeviceMetricColor.BLUE) 330 return "blue"; 331 if (code == DeviceMetricColor.MAGENTA) 332 return "magenta"; 333 if (code == DeviceMetricColor.CYAN) 334 return "cyan"; 335 if (code == DeviceMetricColor.WHITE) 336 return "white"; 337 return "?"; 338 } 339 } 340 341 public enum DeviceMetricCategory { 342 /** 343 * DeviceObservations generated for this DeviceMetric are measured. 344 */ 345 MEASUREMENT, 346 /** 347 * DeviceObservations generated for this DeviceMetric is a setting that will influence the behavior of the Device. 348 */ 349 SETTING, 350 /** 351 * DeviceObservations generated for this DeviceMetric are calculated. 352 */ 353 CALCULATION, 354 /** 355 * The category of this DeviceMetric is unspecified. 356 */ 357 UNSPECIFIED, 358 /** 359 * added to help the parsers 360 */ 361 NULL; 362 public static DeviceMetricCategory fromCode(String codeString) throws FHIRException { 363 if (codeString == null || "".equals(codeString)) 364 return null; 365 if ("measurement".equals(codeString)) 366 return MEASUREMENT; 367 if ("setting".equals(codeString)) 368 return SETTING; 369 if ("calculation".equals(codeString)) 370 return CALCULATION; 371 if ("unspecified".equals(codeString)) 372 return UNSPECIFIED; 373 throw new FHIRException("Unknown DeviceMetricCategory code '"+codeString+"'"); 374 } 375 public String toCode() { 376 switch (this) { 377 case MEASUREMENT: return "measurement"; 378 case SETTING: return "setting"; 379 case CALCULATION: return "calculation"; 380 case UNSPECIFIED: return "unspecified"; 381 case NULL: return null; 382 default: return "?"; 383 } 384 } 385 public String getSystem() { 386 switch (this) { 387 case MEASUREMENT: return "http://hl7.org/fhir/metric-category"; 388 case SETTING: return "http://hl7.org/fhir/metric-category"; 389 case CALCULATION: return "http://hl7.org/fhir/metric-category"; 390 case UNSPECIFIED: return "http://hl7.org/fhir/metric-category"; 391 case NULL: return null; 392 default: return "?"; 393 } 394 } 395 public String getDefinition() { 396 switch (this) { 397 case MEASUREMENT: return "DeviceObservations generated for this DeviceMetric are measured."; 398 case SETTING: return "DeviceObservations generated for this DeviceMetric is a setting that will influence the behavior of the Device."; 399 case CALCULATION: return "DeviceObservations generated for this DeviceMetric are calculated."; 400 case UNSPECIFIED: return "The category of this DeviceMetric is unspecified."; 401 case NULL: return null; 402 default: return "?"; 403 } 404 } 405 public String getDisplay() { 406 switch (this) { 407 case MEASUREMENT: return "Measurement"; 408 case SETTING: return "Setting"; 409 case CALCULATION: return "Calculation"; 410 case UNSPECIFIED: return "Unspecified"; 411 case NULL: return null; 412 default: return "?"; 413 } 414 } 415 } 416 417 public static class DeviceMetricCategoryEnumFactory implements EnumFactory<DeviceMetricCategory> { 418 public DeviceMetricCategory fromCode(String codeString) throws IllegalArgumentException { 419 if (codeString == null || "".equals(codeString)) 420 if (codeString == null || "".equals(codeString)) 421 return null; 422 if ("measurement".equals(codeString)) 423 return DeviceMetricCategory.MEASUREMENT; 424 if ("setting".equals(codeString)) 425 return DeviceMetricCategory.SETTING; 426 if ("calculation".equals(codeString)) 427 return DeviceMetricCategory.CALCULATION; 428 if ("unspecified".equals(codeString)) 429 return DeviceMetricCategory.UNSPECIFIED; 430 throw new IllegalArgumentException("Unknown DeviceMetricCategory code '"+codeString+"'"); 431 } 432 public Enumeration<DeviceMetricCategory> fromType(Base code) throws FHIRException { 433 if (code == null || code.isEmpty()) 434 return null; 435 String codeString = ((PrimitiveType) code).asStringValue(); 436 if (codeString == null || "".equals(codeString)) 437 return null; 438 if ("measurement".equals(codeString)) 439 return new Enumeration<DeviceMetricCategory>(this, DeviceMetricCategory.MEASUREMENT); 440 if ("setting".equals(codeString)) 441 return new Enumeration<DeviceMetricCategory>(this, DeviceMetricCategory.SETTING); 442 if ("calculation".equals(codeString)) 443 return new Enumeration<DeviceMetricCategory>(this, DeviceMetricCategory.CALCULATION); 444 if ("unspecified".equals(codeString)) 445 return new Enumeration<DeviceMetricCategory>(this, DeviceMetricCategory.UNSPECIFIED); 446 throw new FHIRException("Unknown DeviceMetricCategory code '"+codeString+"'"); 447 } 448 public String toCode(DeviceMetricCategory code) { 449 if (code == DeviceMetricCategory.MEASUREMENT) 450 return "measurement"; 451 if (code == DeviceMetricCategory.SETTING) 452 return "setting"; 453 if (code == DeviceMetricCategory.CALCULATION) 454 return "calculation"; 455 if (code == DeviceMetricCategory.UNSPECIFIED) 456 return "unspecified"; 457 return "?"; 458 } 459 } 460 461 public enum DeviceMetricCalibrationType { 462 /** 463 * TODO 464 */ 465 UNSPECIFIED, 466 /** 467 * TODO 468 */ 469 OFFSET, 470 /** 471 * TODO 472 */ 473 GAIN, 474 /** 475 * TODO 476 */ 477 TWOPOINT, 478 /** 479 * added to help the parsers 480 */ 481 NULL; 482 public static DeviceMetricCalibrationType fromCode(String codeString) throws FHIRException { 483 if (codeString == null || "".equals(codeString)) 484 return null; 485 if ("unspecified".equals(codeString)) 486 return UNSPECIFIED; 487 if ("offset".equals(codeString)) 488 return OFFSET; 489 if ("gain".equals(codeString)) 490 return GAIN; 491 if ("two-point".equals(codeString)) 492 return TWOPOINT; 493 throw new FHIRException("Unknown DeviceMetricCalibrationType code '"+codeString+"'"); 494 } 495 public String toCode() { 496 switch (this) { 497 case UNSPECIFIED: return "unspecified"; 498 case OFFSET: return "offset"; 499 case GAIN: return "gain"; 500 case TWOPOINT: return "two-point"; 501 case NULL: return null; 502 default: return "?"; 503 } 504 } 505 public String getSystem() { 506 switch (this) { 507 case UNSPECIFIED: return "http://hl7.org/fhir/metric-calibration-type"; 508 case OFFSET: return "http://hl7.org/fhir/metric-calibration-type"; 509 case GAIN: return "http://hl7.org/fhir/metric-calibration-type"; 510 case TWOPOINT: return "http://hl7.org/fhir/metric-calibration-type"; 511 case NULL: return null; 512 default: return "?"; 513 } 514 } 515 public String getDefinition() { 516 switch (this) { 517 case UNSPECIFIED: return "TODO"; 518 case OFFSET: return "TODO"; 519 case GAIN: return "TODO"; 520 case TWOPOINT: return "TODO"; 521 case NULL: return null; 522 default: return "?"; 523 } 524 } 525 public String getDisplay() { 526 switch (this) { 527 case UNSPECIFIED: return "Unspecified"; 528 case OFFSET: return "Offset"; 529 case GAIN: return "Gain"; 530 case TWOPOINT: return "Two Point"; 531 case NULL: return null; 532 default: return "?"; 533 } 534 } 535 } 536 537 public static class DeviceMetricCalibrationTypeEnumFactory implements EnumFactory<DeviceMetricCalibrationType> { 538 public DeviceMetricCalibrationType fromCode(String codeString) throws IllegalArgumentException { 539 if (codeString == null || "".equals(codeString)) 540 if (codeString == null || "".equals(codeString)) 541 return null; 542 if ("unspecified".equals(codeString)) 543 return DeviceMetricCalibrationType.UNSPECIFIED; 544 if ("offset".equals(codeString)) 545 return DeviceMetricCalibrationType.OFFSET; 546 if ("gain".equals(codeString)) 547 return DeviceMetricCalibrationType.GAIN; 548 if ("two-point".equals(codeString)) 549 return DeviceMetricCalibrationType.TWOPOINT; 550 throw new IllegalArgumentException("Unknown DeviceMetricCalibrationType code '"+codeString+"'"); 551 } 552 public Enumeration<DeviceMetricCalibrationType> fromType(Base code) throws FHIRException { 553 if (code == null || code.isEmpty()) 554 return null; 555 String codeString = ((PrimitiveType) code).asStringValue(); 556 if (codeString == null || "".equals(codeString)) 557 return null; 558 if ("unspecified".equals(codeString)) 559 return new Enumeration<DeviceMetricCalibrationType>(this, DeviceMetricCalibrationType.UNSPECIFIED); 560 if ("offset".equals(codeString)) 561 return new Enumeration<DeviceMetricCalibrationType>(this, DeviceMetricCalibrationType.OFFSET); 562 if ("gain".equals(codeString)) 563 return new Enumeration<DeviceMetricCalibrationType>(this, DeviceMetricCalibrationType.GAIN); 564 if ("two-point".equals(codeString)) 565 return new Enumeration<DeviceMetricCalibrationType>(this, DeviceMetricCalibrationType.TWOPOINT); 566 throw new FHIRException("Unknown DeviceMetricCalibrationType code '"+codeString+"'"); 567 } 568 public String toCode(DeviceMetricCalibrationType code) { 569 if (code == DeviceMetricCalibrationType.UNSPECIFIED) 570 return "unspecified"; 571 if (code == DeviceMetricCalibrationType.OFFSET) 572 return "offset"; 573 if (code == DeviceMetricCalibrationType.GAIN) 574 return "gain"; 575 if (code == DeviceMetricCalibrationType.TWOPOINT) 576 return "two-point"; 577 return "?"; 578 } 579 } 580 581 public enum DeviceMetricCalibrationState { 582 /** 583 * The metric has not been calibrated. 584 */ 585 NOTCALIBRATED, 586 /** 587 * The metric needs to be calibrated. 588 */ 589 CALIBRATIONREQUIRED, 590 /** 591 * The metric has been calibrated. 592 */ 593 CALIBRATED, 594 /** 595 * The state of calibration of this metric is unspecified. 596 */ 597 UNSPECIFIED, 598 /** 599 * added to help the parsers 600 */ 601 NULL; 602 public static DeviceMetricCalibrationState fromCode(String codeString) throws FHIRException { 603 if (codeString == null || "".equals(codeString)) 604 return null; 605 if ("not-calibrated".equals(codeString)) 606 return NOTCALIBRATED; 607 if ("calibration-required".equals(codeString)) 608 return CALIBRATIONREQUIRED; 609 if ("calibrated".equals(codeString)) 610 return CALIBRATED; 611 if ("unspecified".equals(codeString)) 612 return UNSPECIFIED; 613 throw new FHIRException("Unknown DeviceMetricCalibrationState code '"+codeString+"'"); 614 } 615 public String toCode() { 616 switch (this) { 617 case NOTCALIBRATED: return "not-calibrated"; 618 case CALIBRATIONREQUIRED: return "calibration-required"; 619 case CALIBRATED: return "calibrated"; 620 case UNSPECIFIED: return "unspecified"; 621 case NULL: return null; 622 default: return "?"; 623 } 624 } 625 public String getSystem() { 626 switch (this) { 627 case NOTCALIBRATED: return "http://hl7.org/fhir/metric-calibration-state"; 628 case CALIBRATIONREQUIRED: return "http://hl7.org/fhir/metric-calibration-state"; 629 case CALIBRATED: return "http://hl7.org/fhir/metric-calibration-state"; 630 case UNSPECIFIED: return "http://hl7.org/fhir/metric-calibration-state"; 631 case NULL: return null; 632 default: return "?"; 633 } 634 } 635 public String getDefinition() { 636 switch (this) { 637 case NOTCALIBRATED: return "The metric has not been calibrated."; 638 case CALIBRATIONREQUIRED: return "The metric needs to be calibrated."; 639 case CALIBRATED: return "The metric has been calibrated."; 640 case UNSPECIFIED: return "The state of calibration of this metric is unspecified."; 641 case NULL: return null; 642 default: return "?"; 643 } 644 } 645 public String getDisplay() { 646 switch (this) { 647 case NOTCALIBRATED: return "Not Calibrated"; 648 case CALIBRATIONREQUIRED: return "Calibration Required"; 649 case CALIBRATED: return "Calibrated"; 650 case UNSPECIFIED: return "Unspecified"; 651 case NULL: return null; 652 default: return "?"; 653 } 654 } 655 } 656 657 public static class DeviceMetricCalibrationStateEnumFactory implements EnumFactory<DeviceMetricCalibrationState> { 658 public DeviceMetricCalibrationState fromCode(String codeString) throws IllegalArgumentException { 659 if (codeString == null || "".equals(codeString)) 660 if (codeString == null || "".equals(codeString)) 661 return null; 662 if ("not-calibrated".equals(codeString)) 663 return DeviceMetricCalibrationState.NOTCALIBRATED; 664 if ("calibration-required".equals(codeString)) 665 return DeviceMetricCalibrationState.CALIBRATIONREQUIRED; 666 if ("calibrated".equals(codeString)) 667 return DeviceMetricCalibrationState.CALIBRATED; 668 if ("unspecified".equals(codeString)) 669 return DeviceMetricCalibrationState.UNSPECIFIED; 670 throw new IllegalArgumentException("Unknown DeviceMetricCalibrationState code '"+codeString+"'"); 671 } 672 public Enumeration<DeviceMetricCalibrationState> fromType(Base code) throws FHIRException { 673 if (code == null || code.isEmpty()) 674 return null; 675 String codeString = ((PrimitiveType) code).asStringValue(); 676 if (codeString == null || "".equals(codeString)) 677 return null; 678 if ("not-calibrated".equals(codeString)) 679 return new Enumeration<DeviceMetricCalibrationState>(this, DeviceMetricCalibrationState.NOTCALIBRATED); 680 if ("calibration-required".equals(codeString)) 681 return new Enumeration<DeviceMetricCalibrationState>(this, DeviceMetricCalibrationState.CALIBRATIONREQUIRED); 682 if ("calibrated".equals(codeString)) 683 return new Enumeration<DeviceMetricCalibrationState>(this, DeviceMetricCalibrationState.CALIBRATED); 684 if ("unspecified".equals(codeString)) 685 return new Enumeration<DeviceMetricCalibrationState>(this, DeviceMetricCalibrationState.UNSPECIFIED); 686 throw new FHIRException("Unknown DeviceMetricCalibrationState code '"+codeString+"'"); 687 } 688 public String toCode(DeviceMetricCalibrationState code) { 689 if (code == DeviceMetricCalibrationState.NOTCALIBRATED) 690 return "not-calibrated"; 691 if (code == DeviceMetricCalibrationState.CALIBRATIONREQUIRED) 692 return "calibration-required"; 693 if (code == DeviceMetricCalibrationState.CALIBRATED) 694 return "calibrated"; 695 if (code == DeviceMetricCalibrationState.UNSPECIFIED) 696 return "unspecified"; 697 return "?"; 698 } 699 } 700 701 @Block() 702 public static class DeviceMetricCalibrationComponent extends BackboneElement implements IBaseBackboneElement { 703 /** 704 * Describes the type of the calibration method. 705 */ 706 @Child(name = "type", type = {CodeType.class}, order=1, min=0, max=1, modifier=false, summary=true) 707 @Description(shortDefinition="unspecified | offset | gain | two-point", formalDefinition="Describes the type of the calibration method." ) 708 protected Enumeration<DeviceMetricCalibrationType> type; 709 710 /** 711 * Describes the state of the calibration. 712 */ 713 @Child(name = "state", type = {CodeType.class}, order=2, min=0, max=1, modifier=false, summary=true) 714 @Description(shortDefinition="not-calibrated | calibration-required | calibrated | unspecified", formalDefinition="Describes the state of the calibration." ) 715 protected Enumeration<DeviceMetricCalibrationState> state; 716 717 /** 718 * Describes the time last calibration has been performed. 719 */ 720 @Child(name = "time", type = {InstantType.class}, order=3, min=0, max=1, modifier=false, summary=true) 721 @Description(shortDefinition="Describes the time last calibration has been performed", formalDefinition="Describes the time last calibration has been performed." ) 722 protected InstantType time; 723 724 private static final long serialVersionUID = 1163986578L; 725 726 /* 727 * Constructor 728 */ 729 public DeviceMetricCalibrationComponent() { 730 super(); 731 } 732 733 /** 734 * @return {@link #type} (Describes the type of the calibration method.). This is the underlying object with id, value and extensions. The accessor "getType" gives direct access to the value 735 */ 736 public Enumeration<DeviceMetricCalibrationType> getTypeElement() { 737 if (this.type == null) 738 if (Configuration.errorOnAutoCreate()) 739 throw new Error("Attempt to auto-create DeviceMetricCalibrationComponent.type"); 740 else if (Configuration.doAutoCreate()) 741 this.type = new Enumeration<DeviceMetricCalibrationType>(new DeviceMetricCalibrationTypeEnumFactory()); // bb 742 return this.type; 743 } 744 745 public boolean hasTypeElement() { 746 return this.type != null && !this.type.isEmpty(); 747 } 748 749 public boolean hasType() { 750 return this.type != null && !this.type.isEmpty(); 751 } 752 753 /** 754 * @param value {@link #type} (Describes the type of the calibration method.). This is the underlying object with id, value and extensions. The accessor "getType" gives direct access to the value 755 */ 756 public DeviceMetricCalibrationComponent setTypeElement(Enumeration<DeviceMetricCalibrationType> value) { 757 this.type = value; 758 return this; 759 } 760 761 /** 762 * @return Describes the type of the calibration method. 763 */ 764 public DeviceMetricCalibrationType getType() { 765 return this.type == null ? null : this.type.getValue(); 766 } 767 768 /** 769 * @param value Describes the type of the calibration method. 770 */ 771 public DeviceMetricCalibrationComponent setType(DeviceMetricCalibrationType value) { 772 if (value == null) 773 this.type = null; 774 else { 775 if (this.type == null) 776 this.type = new Enumeration<DeviceMetricCalibrationType>(new DeviceMetricCalibrationTypeEnumFactory()); 777 this.type.setValue(value); 778 } 779 return this; 780 } 781 782 /** 783 * @return {@link #state} (Describes the state of the calibration.). This is the underlying object with id, value and extensions. The accessor "getState" gives direct access to the value 784 */ 785 public Enumeration<DeviceMetricCalibrationState> getStateElement() { 786 if (this.state == null) 787 if (Configuration.errorOnAutoCreate()) 788 throw new Error("Attempt to auto-create DeviceMetricCalibrationComponent.state"); 789 else if (Configuration.doAutoCreate()) 790 this.state = new Enumeration<DeviceMetricCalibrationState>(new DeviceMetricCalibrationStateEnumFactory()); // bb 791 return this.state; 792 } 793 794 public boolean hasStateElement() { 795 return this.state != null && !this.state.isEmpty(); 796 } 797 798 public boolean hasState() { 799 return this.state != null && !this.state.isEmpty(); 800 } 801 802 /** 803 * @param value {@link #state} (Describes the state of the calibration.). This is the underlying object with id, value and extensions. The accessor "getState" gives direct access to the value 804 */ 805 public DeviceMetricCalibrationComponent setStateElement(Enumeration<DeviceMetricCalibrationState> value) { 806 this.state = value; 807 return this; 808 } 809 810 /** 811 * @return Describes the state of the calibration. 812 */ 813 public DeviceMetricCalibrationState getState() { 814 return this.state == null ? null : this.state.getValue(); 815 } 816 817 /** 818 * @param value Describes the state of the calibration. 819 */ 820 public DeviceMetricCalibrationComponent setState(DeviceMetricCalibrationState value) { 821 if (value == null) 822 this.state = null; 823 else { 824 if (this.state == null) 825 this.state = new Enumeration<DeviceMetricCalibrationState>(new DeviceMetricCalibrationStateEnumFactory()); 826 this.state.setValue(value); 827 } 828 return this; 829 } 830 831 /** 832 * @return {@link #time} (Describes the time last calibration has been performed.). This is the underlying object with id, value and extensions. The accessor "getTime" gives direct access to the value 833 */ 834 public InstantType getTimeElement() { 835 if (this.time == null) 836 if (Configuration.errorOnAutoCreate()) 837 throw new Error("Attempt to auto-create DeviceMetricCalibrationComponent.time"); 838 else if (Configuration.doAutoCreate()) 839 this.time = new InstantType(); // bb 840 return this.time; 841 } 842 843 public boolean hasTimeElement() { 844 return this.time != null && !this.time.isEmpty(); 845 } 846 847 public boolean hasTime() { 848 return this.time != null && !this.time.isEmpty(); 849 } 850 851 /** 852 * @param value {@link #time} (Describes the time last calibration has been performed.). This is the underlying object with id, value and extensions. The accessor "getTime" gives direct access to the value 853 */ 854 public DeviceMetricCalibrationComponent setTimeElement(InstantType value) { 855 this.time = value; 856 return this; 857 } 858 859 /** 860 * @return Describes the time last calibration has been performed. 861 */ 862 public Date getTime() { 863 return this.time == null ? null : this.time.getValue(); 864 } 865 866 /** 867 * @param value Describes the time last calibration has been performed. 868 */ 869 public DeviceMetricCalibrationComponent setTime(Date value) { 870 if (value == null) 871 this.time = null; 872 else { 873 if (this.time == null) 874 this.time = new InstantType(); 875 this.time.setValue(value); 876 } 877 return this; 878 } 879 880 protected void listChildren(List<Property> childrenList) { 881 super.listChildren(childrenList); 882 childrenList.add(new Property("type", "code", "Describes the type of the calibration method.", 0, java.lang.Integer.MAX_VALUE, type)); 883 childrenList.add(new Property("state", "code", "Describes the state of the calibration.", 0, java.lang.Integer.MAX_VALUE, state)); 884 childrenList.add(new Property("time", "instant", "Describes the time last calibration has been performed.", 0, java.lang.Integer.MAX_VALUE, time)); 885 } 886 887 @Override 888 public void setProperty(String name, Base value) throws FHIRException { 889 if (name.equals("type")) 890 this.type = new DeviceMetricCalibrationTypeEnumFactory().fromType(value); // Enumeration<DeviceMetricCalibrationType> 891 else if (name.equals("state")) 892 this.state = new DeviceMetricCalibrationStateEnumFactory().fromType(value); // Enumeration<DeviceMetricCalibrationState> 893 else if (name.equals("time")) 894 this.time = castToInstant(value); // InstantType 895 else 896 super.setProperty(name, value); 897 } 898 899 @Override 900 public Base addChild(String name) throws FHIRException { 901 if (name.equals("type")) { 902 throw new FHIRException("Cannot call addChild on a primitive type DeviceMetric.type"); 903 } 904 else if (name.equals("state")) { 905 throw new FHIRException("Cannot call addChild on a primitive type DeviceMetric.state"); 906 } 907 else if (name.equals("time")) { 908 throw new FHIRException("Cannot call addChild on a primitive type DeviceMetric.time"); 909 } 910 else 911 return super.addChild(name); 912 } 913 914 public DeviceMetricCalibrationComponent copy() { 915 DeviceMetricCalibrationComponent dst = new DeviceMetricCalibrationComponent(); 916 copyValues(dst); 917 dst.type = type == null ? null : type.copy(); 918 dst.state = state == null ? null : state.copy(); 919 dst.time = time == null ? null : time.copy(); 920 return dst; 921 } 922 923 @Override 924 public boolean equalsDeep(Base other) { 925 if (!super.equalsDeep(other)) 926 return false; 927 if (!(other instanceof DeviceMetricCalibrationComponent)) 928 return false; 929 DeviceMetricCalibrationComponent o = (DeviceMetricCalibrationComponent) other; 930 return compareDeep(type, o.type, true) && compareDeep(state, o.state, true) && compareDeep(time, o.time, true) 931 ; 932 } 933 934 @Override 935 public boolean equalsShallow(Base other) { 936 if (!super.equalsShallow(other)) 937 return false; 938 if (!(other instanceof DeviceMetricCalibrationComponent)) 939 return false; 940 DeviceMetricCalibrationComponent o = (DeviceMetricCalibrationComponent) other; 941 return compareValues(type, o.type, true) && compareValues(state, o.state, true) && compareValues(time, o.time, true) 942 ; 943 } 944 945 public boolean isEmpty() { 946 return super.isEmpty() && (type == null || type.isEmpty()) && (state == null || state.isEmpty()) 947 && (time == null || time.isEmpty()); 948 } 949 950 public String fhirType() { 951 return "DeviceMetric.calibration"; 952 953 } 954 955 } 956 957 /** 958 * Describes the type of the metric. For example: Heart Rate, PEEP Setting, etc. 959 */ 960 @Child(name = "type", type = {CodeableConcept.class}, order=0, min=1, max=1, modifier=false, summary=true) 961 @Description(shortDefinition="Type of metric", formalDefinition="Describes the type of the metric. For example: Heart Rate, PEEP Setting, etc." ) 962 protected CodeableConcept type; 963 964 /** 965 * Describes the unique identification of this metric that has been assigned by the device or gateway software. For example: handle ID. It should be noted that in order to make the identifier unique, the system element of the identifier should be set to the unique identifier of the device. 966 */ 967 @Child(name = "identifier", type = {Identifier.class}, order=1, min=1, max=1, modifier=false, summary=true) 968 @Description(shortDefinition="Unique identifier of this DeviceMetric", formalDefinition="Describes the unique identification of this metric that has been assigned by the device or gateway software. For example: handle ID. It should be noted that in order to make the identifier unique, the system element of the identifier should be set to the unique identifier of the device." ) 969 protected Identifier identifier; 970 971 /** 972 * Describes the unit that an observed value determined for this metric will have. For example: Percent, Seconds, etc. 973 */ 974 @Child(name = "unit", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=true) 975 @Description(shortDefinition="Unit of metric", formalDefinition="Describes the unit that an observed value determined for this metric will have. For example: Percent, Seconds, etc." ) 976 protected CodeableConcept unit; 977 978 /** 979 * Describes the link to the Device that this DeviceMetric belongs to and that contains administrative device information such as manufacture, serial number, etc. 980 */ 981 @Child(name = "source", type = {Device.class}, order=3, min=0, max=1, modifier=false, summary=true) 982 @Description(shortDefinition="Describes the link to the source Device", formalDefinition="Describes the link to the Device that this DeviceMetric belongs to and that contains administrative device information such as manufacture, serial number, etc." ) 983 protected Reference source; 984 985 /** 986 * The actual object that is the target of the reference (Describes the link to the Device that this DeviceMetric belongs to and that contains administrative device information such as manufacture, serial number, etc.) 987 */ 988 protected Device sourceTarget; 989 990 /** 991 * Describes the link to the DeviceComponent that this DeviceMetric belongs to and that provide information about the location of this DeviceMetric in the containment structure of the parent Device. An example would be a DeviceComponent that represents a Channel. This reference can be used by a client application to distinguish DeviceMetrics that have the same type, but should be interpreted based on their containment location. 992 */ 993 @Child(name = "parent", type = {DeviceComponent.class}, order=4, min=0, max=1, modifier=false, summary=true) 994 @Description(shortDefinition="Describes the link to the parent DeviceComponent", formalDefinition="Describes the link to the DeviceComponent that this DeviceMetric belongs to and that provide information about the location of this DeviceMetric in the containment structure of the parent Device. An example would be a DeviceComponent that represents a Channel. This reference can be used by a client application to distinguish DeviceMetrics that have the same type, but should be interpreted based on their containment location." ) 995 protected Reference parent; 996 997 /** 998 * The actual object that is the target of the reference (Describes the link to the DeviceComponent that this DeviceMetric belongs to and that provide information about the location of this DeviceMetric in the containment structure of the parent Device. An example would be a DeviceComponent that represents a Channel. This reference can be used by a client application to distinguish DeviceMetrics that have the same type, but should be interpreted based on their containment location.) 999 */ 1000 protected DeviceComponent parentTarget; 1001 1002 /** 1003 * Indicates current operational state of the device. For example: On, Off, Standby, etc. 1004 */ 1005 @Child(name = "operationalStatus", type = {CodeType.class}, order=5, min=0, max=1, modifier=false, summary=true) 1006 @Description(shortDefinition="on | off | standby", formalDefinition="Indicates current operational state of the device. For example: On, Off, Standby, etc." ) 1007 protected Enumeration<DeviceMetricOperationalStatus> operationalStatus; 1008 1009 /** 1010 * Describes the color representation for the metric. This is often used to aid clinicians to track and identify parameter types by color. In practice, consider a Patient Monitor that has ECG/HR and Pleth for example; the parameters are displayed in different characteristic colors, such as HR-blue, BP-green, and PR and SpO2- magenta. 1011 */ 1012 @Child(name = "color", type = {CodeType.class}, order=6, min=0, max=1, modifier=false, summary=true) 1013 @Description(shortDefinition="black | red | green | yellow | blue | magenta | cyan | white", formalDefinition="Describes the color representation for the metric. This is often used to aid clinicians to track and identify parameter types by color. In practice, consider a Patient Monitor that has ECG/HR and Pleth for example; the parameters are displayed in different characteristic colors, such as HR-blue, BP-green, and PR and SpO2- magenta." ) 1014 protected Enumeration<DeviceMetricColor> color; 1015 1016 /** 1017 * Indicates the category of the observation generation process. A DeviceMetric can be for example a setting, measurement, or calculation. 1018 */ 1019 @Child(name = "category", type = {CodeType.class}, order=7, min=1, max=1, modifier=false, summary=true) 1020 @Description(shortDefinition="measurement | setting | calculation | unspecified", formalDefinition="Indicates the category of the observation generation process. A DeviceMetric can be for example a setting, measurement, or calculation." ) 1021 protected Enumeration<DeviceMetricCategory> category; 1022 1023 /** 1024 * Describes the measurement repetition time. This is not necessarily the same as the update period. The measurement repetition time can range from milliseconds up to hours. An example for a measurement repetition time in the range of milliseconds is the sampling rate of an ECG. An example for a measurement repetition time in the range of hours is a NIBP that is triggered automatically every hour. The update period may be different than the measurement repetition time, if the device does not update the published observed value with the same frequency as it was measured. 1025 */ 1026 @Child(name = "measurementPeriod", type = {Timing.class}, order=8, min=0, max=1, modifier=false, summary=true) 1027 @Description(shortDefinition="Describes the measurement repetition time", formalDefinition="Describes the measurement repetition time. This is not necessarily the same as the update period. The measurement repetition time can range from milliseconds up to hours. An example for a measurement repetition time in the range of milliseconds is the sampling rate of an ECG. An example for a measurement repetition time in the range of hours is a NIBP that is triggered automatically every hour. The update period may be different than the measurement repetition time, if the device does not update the published observed value with the same frequency as it was measured." ) 1028 protected Timing measurementPeriod; 1029 1030 /** 1031 * Describes the calibrations that have been performed or that are required to be performed. 1032 */ 1033 @Child(name = "calibration", type = {}, order=9, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 1034 @Description(shortDefinition="Describes the calibrations that have been performed or that are required to be performed", formalDefinition="Describes the calibrations that have been performed or that are required to be performed." ) 1035 protected List<DeviceMetricCalibrationComponent> calibration; 1036 1037 private static final long serialVersionUID = 1786401018L; 1038 1039 /* 1040 * Constructor 1041 */ 1042 public DeviceMetric() { 1043 super(); 1044 } 1045 1046 /* 1047 * Constructor 1048 */ 1049 public DeviceMetric(CodeableConcept type, Identifier identifier, Enumeration<DeviceMetricCategory> category) { 1050 super(); 1051 this.type = type; 1052 this.identifier = identifier; 1053 this.category = category; 1054 } 1055 1056 /** 1057 * @return {@link #type} (Describes the type of the metric. For example: Heart Rate, PEEP Setting, etc.) 1058 */ 1059 public CodeableConcept getType() { 1060 if (this.type == null) 1061 if (Configuration.errorOnAutoCreate()) 1062 throw new Error("Attempt to auto-create DeviceMetric.type"); 1063 else if (Configuration.doAutoCreate()) 1064 this.type = new CodeableConcept(); // cc 1065 return this.type; 1066 } 1067 1068 public boolean hasType() { 1069 return this.type != null && !this.type.isEmpty(); 1070 } 1071 1072 /** 1073 * @param value {@link #type} (Describes the type of the metric. For example: Heart Rate, PEEP Setting, etc.) 1074 */ 1075 public DeviceMetric setType(CodeableConcept value) { 1076 this.type = value; 1077 return this; 1078 } 1079 1080 /** 1081 * @return {@link #identifier} (Describes the unique identification of this metric that has been assigned by the device or gateway software. For example: handle ID. It should be noted that in order to make the identifier unique, the system element of the identifier should be set to the unique identifier of the device.) 1082 */ 1083 public Identifier getIdentifier() { 1084 if (this.identifier == null) 1085 if (Configuration.errorOnAutoCreate()) 1086 throw new Error("Attempt to auto-create DeviceMetric.identifier"); 1087 else if (Configuration.doAutoCreate()) 1088 this.identifier = new Identifier(); // cc 1089 return this.identifier; 1090 } 1091 1092 public boolean hasIdentifier() { 1093 return this.identifier != null && !this.identifier.isEmpty(); 1094 } 1095 1096 /** 1097 * @param value {@link #identifier} (Describes the unique identification of this metric that has been assigned by the device or gateway software. For example: handle ID. It should be noted that in order to make the identifier unique, the system element of the identifier should be set to the unique identifier of the device.) 1098 */ 1099 public DeviceMetric setIdentifier(Identifier value) { 1100 this.identifier = value; 1101 return this; 1102 } 1103 1104 /** 1105 * @return {@link #unit} (Describes the unit that an observed value determined for this metric will have. For example: Percent, Seconds, etc.) 1106 */ 1107 public CodeableConcept getUnit() { 1108 if (this.unit == null) 1109 if (Configuration.errorOnAutoCreate()) 1110 throw new Error("Attempt to auto-create DeviceMetric.unit"); 1111 else if (Configuration.doAutoCreate()) 1112 this.unit = new CodeableConcept(); // cc 1113 return this.unit; 1114 } 1115 1116 public boolean hasUnit() { 1117 return this.unit != null && !this.unit.isEmpty(); 1118 } 1119 1120 /** 1121 * @param value {@link #unit} (Describes the unit that an observed value determined for this metric will have. For example: Percent, Seconds, etc.) 1122 */ 1123 public DeviceMetric setUnit(CodeableConcept value) { 1124 this.unit = value; 1125 return this; 1126 } 1127 1128 /** 1129 * @return {@link #source} (Describes the link to the Device that this DeviceMetric belongs to and that contains administrative device information such as manufacture, serial number, etc.) 1130 */ 1131 public Reference getSource() { 1132 if (this.source == null) 1133 if (Configuration.errorOnAutoCreate()) 1134 throw new Error("Attempt to auto-create DeviceMetric.source"); 1135 else if (Configuration.doAutoCreate()) 1136 this.source = new Reference(); // cc 1137 return this.source; 1138 } 1139 1140 public boolean hasSource() { 1141 return this.source != null && !this.source.isEmpty(); 1142 } 1143 1144 /** 1145 * @param value {@link #source} (Describes the link to the Device that this DeviceMetric belongs to and that contains administrative device information such as manufacture, serial number, etc.) 1146 */ 1147 public DeviceMetric setSource(Reference value) { 1148 this.source = value; 1149 return this; 1150 } 1151 1152 /** 1153 * @return {@link #source} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (Describes the link to the Device that this DeviceMetric belongs to and that contains administrative device information such as manufacture, serial number, etc.) 1154 */ 1155 public Device getSourceTarget() { 1156 if (this.sourceTarget == null) 1157 if (Configuration.errorOnAutoCreate()) 1158 throw new Error("Attempt to auto-create DeviceMetric.source"); 1159 else if (Configuration.doAutoCreate()) 1160 this.sourceTarget = new Device(); // aa 1161 return this.sourceTarget; 1162 } 1163 1164 /** 1165 * @param value {@link #source} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (Describes the link to the Device that this DeviceMetric belongs to and that contains administrative device information such as manufacture, serial number, etc.) 1166 */ 1167 public DeviceMetric setSourceTarget(Device value) { 1168 this.sourceTarget = value; 1169 return this; 1170 } 1171 1172 /** 1173 * @return {@link #parent} (Describes the link to the DeviceComponent that this DeviceMetric belongs to and that provide information about the location of this DeviceMetric in the containment structure of the parent Device. An example would be a DeviceComponent that represents a Channel. This reference can be used by a client application to distinguish DeviceMetrics that have the same type, but should be interpreted based on their containment location.) 1174 */ 1175 public Reference getParent() { 1176 if (this.parent == null) 1177 if (Configuration.errorOnAutoCreate()) 1178 throw new Error("Attempt to auto-create DeviceMetric.parent"); 1179 else if (Configuration.doAutoCreate()) 1180 this.parent = new Reference(); // cc 1181 return this.parent; 1182 } 1183 1184 public boolean hasParent() { 1185 return this.parent != null && !this.parent.isEmpty(); 1186 } 1187 1188 /** 1189 * @param value {@link #parent} (Describes the link to the DeviceComponent that this DeviceMetric belongs to and that provide information about the location of this DeviceMetric in the containment structure of the parent Device. An example would be a DeviceComponent that represents a Channel. This reference can be used by a client application to distinguish DeviceMetrics that have the same type, but should be interpreted based on their containment location.) 1190 */ 1191 public DeviceMetric setParent(Reference value) { 1192 this.parent = value; 1193 return this; 1194 } 1195 1196 /** 1197 * @return {@link #parent} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (Describes the link to the DeviceComponent that this DeviceMetric belongs to and that provide information about the location of this DeviceMetric in the containment structure of the parent Device. An example would be a DeviceComponent that represents a Channel. This reference can be used by a client application to distinguish DeviceMetrics that have the same type, but should be interpreted based on their containment location.) 1198 */ 1199 public DeviceComponent getParentTarget() { 1200 if (this.parentTarget == null) 1201 if (Configuration.errorOnAutoCreate()) 1202 throw new Error("Attempt to auto-create DeviceMetric.parent"); 1203 else if (Configuration.doAutoCreate()) 1204 this.parentTarget = new DeviceComponent(); // aa 1205 return this.parentTarget; 1206 } 1207 1208 /** 1209 * @param value {@link #parent} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (Describes the link to the DeviceComponent that this DeviceMetric belongs to and that provide information about the location of this DeviceMetric in the containment structure of the parent Device. An example would be a DeviceComponent that represents a Channel. This reference can be used by a client application to distinguish DeviceMetrics that have the same type, but should be interpreted based on their containment location.) 1210 */ 1211 public DeviceMetric setParentTarget(DeviceComponent value) { 1212 this.parentTarget = value; 1213 return this; 1214 } 1215 1216 /** 1217 * @return {@link #operationalStatus} (Indicates current operational state of the device. For example: On, Off, Standby, etc.). This is the underlying object with id, value and extensions. The accessor "getOperationalStatus" gives direct access to the value 1218 */ 1219 public Enumeration<DeviceMetricOperationalStatus> getOperationalStatusElement() { 1220 if (this.operationalStatus == null) 1221 if (Configuration.errorOnAutoCreate()) 1222 throw new Error("Attempt to auto-create DeviceMetric.operationalStatus"); 1223 else if (Configuration.doAutoCreate()) 1224 this.operationalStatus = new Enumeration<DeviceMetricOperationalStatus>(new DeviceMetricOperationalStatusEnumFactory()); // bb 1225 return this.operationalStatus; 1226 } 1227 1228 public boolean hasOperationalStatusElement() { 1229 return this.operationalStatus != null && !this.operationalStatus.isEmpty(); 1230 } 1231 1232 public boolean hasOperationalStatus() { 1233 return this.operationalStatus != null && !this.operationalStatus.isEmpty(); 1234 } 1235 1236 /** 1237 * @param value {@link #operationalStatus} (Indicates current operational state of the device. For example: On, Off, Standby, etc.). This is the underlying object with id, value and extensions. The accessor "getOperationalStatus" gives direct access to the value 1238 */ 1239 public DeviceMetric setOperationalStatusElement(Enumeration<DeviceMetricOperationalStatus> value) { 1240 this.operationalStatus = value; 1241 return this; 1242 } 1243 1244 /** 1245 * @return Indicates current operational state of the device. For example: On, Off, Standby, etc. 1246 */ 1247 public DeviceMetricOperationalStatus getOperationalStatus() { 1248 return this.operationalStatus == null ? null : this.operationalStatus.getValue(); 1249 } 1250 1251 /** 1252 * @param value Indicates current operational state of the device. For example: On, Off, Standby, etc. 1253 */ 1254 public DeviceMetric setOperationalStatus(DeviceMetricOperationalStatus value) { 1255 if (value == null) 1256 this.operationalStatus = null; 1257 else { 1258 if (this.operationalStatus == null) 1259 this.operationalStatus = new Enumeration<DeviceMetricOperationalStatus>(new DeviceMetricOperationalStatusEnumFactory()); 1260 this.operationalStatus.setValue(value); 1261 } 1262 return this; 1263 } 1264 1265 /** 1266 * @return {@link #color} (Describes the color representation for the metric. This is often used to aid clinicians to track and identify parameter types by color. In practice, consider a Patient Monitor that has ECG/HR and Pleth for example; the parameters are displayed in different characteristic colors, such as HR-blue, BP-green, and PR and SpO2- magenta.). This is the underlying object with id, value and extensions. The accessor "getColor" gives direct access to the value 1267 */ 1268 public Enumeration<DeviceMetricColor> getColorElement() { 1269 if (this.color == null) 1270 if (Configuration.errorOnAutoCreate()) 1271 throw new Error("Attempt to auto-create DeviceMetric.color"); 1272 else if (Configuration.doAutoCreate()) 1273 this.color = new Enumeration<DeviceMetricColor>(new DeviceMetricColorEnumFactory()); // bb 1274 return this.color; 1275 } 1276 1277 public boolean hasColorElement() { 1278 return this.color != null && !this.color.isEmpty(); 1279 } 1280 1281 public boolean hasColor() { 1282 return this.color != null && !this.color.isEmpty(); 1283 } 1284 1285 /** 1286 * @param value {@link #color} (Describes the color representation for the metric. This is often used to aid clinicians to track and identify parameter types by color. In practice, consider a Patient Monitor that has ECG/HR and Pleth for example; the parameters are displayed in different characteristic colors, such as HR-blue, BP-green, and PR and SpO2- magenta.). This is the underlying object with id, value and extensions. The accessor "getColor" gives direct access to the value 1287 */ 1288 public DeviceMetric setColorElement(Enumeration<DeviceMetricColor> value) { 1289 this.color = value; 1290 return this; 1291 } 1292 1293 /** 1294 * @return Describes the color representation for the metric. This is often used to aid clinicians to track and identify parameter types by color. In practice, consider a Patient Monitor that has ECG/HR and Pleth for example; the parameters are displayed in different characteristic colors, such as HR-blue, BP-green, and PR and SpO2- magenta. 1295 */ 1296 public DeviceMetricColor getColor() { 1297 return this.color == null ? null : this.color.getValue(); 1298 } 1299 1300 /** 1301 * @param value Describes the color representation for the metric. This is often used to aid clinicians to track and identify parameter types by color. In practice, consider a Patient Monitor that has ECG/HR and Pleth for example; the parameters are displayed in different characteristic colors, such as HR-blue, BP-green, and PR and SpO2- magenta. 1302 */ 1303 public DeviceMetric setColor(DeviceMetricColor value) { 1304 if (value == null) 1305 this.color = null; 1306 else { 1307 if (this.color == null) 1308 this.color = new Enumeration<DeviceMetricColor>(new DeviceMetricColorEnumFactory()); 1309 this.color.setValue(value); 1310 } 1311 return this; 1312 } 1313 1314 /** 1315 * @return {@link #category} (Indicates the category of the observation generation process. A DeviceMetric can be for example a setting, measurement, or calculation.). This is the underlying object with id, value and extensions. The accessor "getCategory" gives direct access to the value 1316 */ 1317 public Enumeration<DeviceMetricCategory> getCategoryElement() { 1318 if (this.category == null) 1319 if (Configuration.errorOnAutoCreate()) 1320 throw new Error("Attempt to auto-create DeviceMetric.category"); 1321 else if (Configuration.doAutoCreate()) 1322 this.category = new Enumeration<DeviceMetricCategory>(new DeviceMetricCategoryEnumFactory()); // bb 1323 return this.category; 1324 } 1325 1326 public boolean hasCategoryElement() { 1327 return this.category != null && !this.category.isEmpty(); 1328 } 1329 1330 public boolean hasCategory() { 1331 return this.category != null && !this.category.isEmpty(); 1332 } 1333 1334 /** 1335 * @param value {@link #category} (Indicates the category of the observation generation process. A DeviceMetric can be for example a setting, measurement, or calculation.). This is the underlying object with id, value and extensions. The accessor "getCategory" gives direct access to the value 1336 */ 1337 public DeviceMetric setCategoryElement(Enumeration<DeviceMetricCategory> value) { 1338 this.category = value; 1339 return this; 1340 } 1341 1342 /** 1343 * @return Indicates the category of the observation generation process. A DeviceMetric can be for example a setting, measurement, or calculation. 1344 */ 1345 public DeviceMetricCategory getCategory() { 1346 return this.category == null ? null : this.category.getValue(); 1347 } 1348 1349 /** 1350 * @param value Indicates the category of the observation generation process. A DeviceMetric can be for example a setting, measurement, or calculation. 1351 */ 1352 public DeviceMetric setCategory(DeviceMetricCategory value) { 1353 if (this.category == null) 1354 this.category = new Enumeration<DeviceMetricCategory>(new DeviceMetricCategoryEnumFactory()); 1355 this.category.setValue(value); 1356 return this; 1357 } 1358 1359 /** 1360 * @return {@link #measurementPeriod} (Describes the measurement repetition time. This is not necessarily the same as the update period. The measurement repetition time can range from milliseconds up to hours. An example for a measurement repetition time in the range of milliseconds is the sampling rate of an ECG. An example for a measurement repetition time in the range of hours is a NIBP that is triggered automatically every hour. The update period may be different than the measurement repetition time, if the device does not update the published observed value with the same frequency as it was measured.) 1361 */ 1362 public Timing getMeasurementPeriod() { 1363 if (this.measurementPeriod == null) 1364 if (Configuration.errorOnAutoCreate()) 1365 throw new Error("Attempt to auto-create DeviceMetric.measurementPeriod"); 1366 else if (Configuration.doAutoCreate()) 1367 this.measurementPeriod = new Timing(); // cc 1368 return this.measurementPeriod; 1369 } 1370 1371 public boolean hasMeasurementPeriod() { 1372 return this.measurementPeriod != null && !this.measurementPeriod.isEmpty(); 1373 } 1374 1375 /** 1376 * @param value {@link #measurementPeriod} (Describes the measurement repetition time. This is not necessarily the same as the update period. The measurement repetition time can range from milliseconds up to hours. An example for a measurement repetition time in the range of milliseconds is the sampling rate of an ECG. An example for a measurement repetition time in the range of hours is a NIBP that is triggered automatically every hour. The update period may be different than the measurement repetition time, if the device does not update the published observed value with the same frequency as it was measured.) 1377 */ 1378 public DeviceMetric setMeasurementPeriod(Timing value) { 1379 this.measurementPeriod = value; 1380 return this; 1381 } 1382 1383 /** 1384 * @return {@link #calibration} (Describes the calibrations that have been performed or that are required to be performed.) 1385 */ 1386 public List<DeviceMetricCalibrationComponent> getCalibration() { 1387 if (this.calibration == null) 1388 this.calibration = new ArrayList<DeviceMetricCalibrationComponent>(); 1389 return this.calibration; 1390 } 1391 1392 public boolean hasCalibration() { 1393 if (this.calibration == null) 1394 return false; 1395 for (DeviceMetricCalibrationComponent item : this.calibration) 1396 if (!item.isEmpty()) 1397 return true; 1398 return false; 1399 } 1400 1401 /** 1402 * @return {@link #calibration} (Describes the calibrations that have been performed or that are required to be performed.) 1403 */ 1404 // syntactic sugar 1405 public DeviceMetricCalibrationComponent addCalibration() { //3 1406 DeviceMetricCalibrationComponent t = new DeviceMetricCalibrationComponent(); 1407 if (this.calibration == null) 1408 this.calibration = new ArrayList<DeviceMetricCalibrationComponent>(); 1409 this.calibration.add(t); 1410 return t; 1411 } 1412 1413 // syntactic sugar 1414 public DeviceMetric addCalibration(DeviceMetricCalibrationComponent t) { //3 1415 if (t == null) 1416 return this; 1417 if (this.calibration == null) 1418 this.calibration = new ArrayList<DeviceMetricCalibrationComponent>(); 1419 this.calibration.add(t); 1420 return this; 1421 } 1422 1423 protected void listChildren(List<Property> childrenList) { 1424 super.listChildren(childrenList); 1425 childrenList.add(new Property("type", "CodeableConcept", "Describes the type of the metric. For example: Heart Rate, PEEP Setting, etc.", 0, java.lang.Integer.MAX_VALUE, type)); 1426 childrenList.add(new Property("identifier", "Identifier", "Describes the unique identification of this metric that has been assigned by the device or gateway software. For example: handle ID. It should be noted that in order to make the identifier unique, the system element of the identifier should be set to the unique identifier of the device.", 0, java.lang.Integer.MAX_VALUE, identifier)); 1427 childrenList.add(new Property("unit", "CodeableConcept", "Describes the unit that an observed value determined for this metric will have. For example: Percent, Seconds, etc.", 0, java.lang.Integer.MAX_VALUE, unit)); 1428 childrenList.add(new Property("source", "Reference(Device)", "Describes the link to the Device that this DeviceMetric belongs to and that contains administrative device information such as manufacture, serial number, etc.", 0, java.lang.Integer.MAX_VALUE, source)); 1429 childrenList.add(new Property("parent", "Reference(DeviceComponent)", "Describes the link to the DeviceComponent that this DeviceMetric belongs to and that provide information about the location of this DeviceMetric in the containment structure of the parent Device. An example would be a DeviceComponent that represents a Channel. This reference can be used by a client application to distinguish DeviceMetrics that have the same type, but should be interpreted based on their containment location.", 0, java.lang.Integer.MAX_VALUE, parent)); 1430 childrenList.add(new Property("operationalStatus", "code", "Indicates current operational state of the device. For example: On, Off, Standby, etc.", 0, java.lang.Integer.MAX_VALUE, operationalStatus)); 1431 childrenList.add(new Property("color", "code", "Describes the color representation for the metric. This is often used to aid clinicians to track and identify parameter types by color. In practice, consider a Patient Monitor that has ECG/HR and Pleth for example; the parameters are displayed in different characteristic colors, such as HR-blue, BP-green, and PR and SpO2- magenta.", 0, java.lang.Integer.MAX_VALUE, color)); 1432 childrenList.add(new Property("category", "code", "Indicates the category of the observation generation process. A DeviceMetric can be for example a setting, measurement, or calculation.", 0, java.lang.Integer.MAX_VALUE, category)); 1433 childrenList.add(new Property("measurementPeriod", "Timing", "Describes the measurement repetition time. This is not necessarily the same as the update period. The measurement repetition time can range from milliseconds up to hours. An example for a measurement repetition time in the range of milliseconds is the sampling rate of an ECG. An example for a measurement repetition time in the range of hours is a NIBP that is triggered automatically every hour. The update period may be different than the measurement repetition time, if the device does not update the published observed value with the same frequency as it was measured.", 0, java.lang.Integer.MAX_VALUE, measurementPeriod)); 1434 childrenList.add(new Property("calibration", "", "Describes the calibrations that have been performed or that are required to be performed.", 0, java.lang.Integer.MAX_VALUE, calibration)); 1435 } 1436 1437 @Override 1438 public void setProperty(String name, Base value) throws FHIRException { 1439 if (name.equals("type")) 1440 this.type = castToCodeableConcept(value); // CodeableConcept 1441 else if (name.equals("identifier")) 1442 this.identifier = castToIdentifier(value); // Identifier 1443 else if (name.equals("unit")) 1444 this.unit = castToCodeableConcept(value); // CodeableConcept 1445 else if (name.equals("source")) 1446 this.source = castToReference(value); // Reference 1447 else if (name.equals("parent")) 1448 this.parent = castToReference(value); // Reference 1449 else if (name.equals("operationalStatus")) 1450 this.operationalStatus = new DeviceMetricOperationalStatusEnumFactory().fromType(value); // Enumeration<DeviceMetricOperationalStatus> 1451 else if (name.equals("color")) 1452 this.color = new DeviceMetricColorEnumFactory().fromType(value); // Enumeration<DeviceMetricColor> 1453 else if (name.equals("category")) 1454 this.category = new DeviceMetricCategoryEnumFactory().fromType(value); // Enumeration<DeviceMetricCategory> 1455 else if (name.equals("measurementPeriod")) 1456 this.measurementPeriod = castToTiming(value); // Timing 1457 else if (name.equals("calibration")) 1458 this.getCalibration().add((DeviceMetricCalibrationComponent) value); 1459 else 1460 super.setProperty(name, value); 1461 } 1462 1463 @Override 1464 public Base addChild(String name) throws FHIRException { 1465 if (name.equals("type")) { 1466 this.type = new CodeableConcept(); 1467 return this.type; 1468 } 1469 else if (name.equals("identifier")) { 1470 this.identifier = new Identifier(); 1471 return this.identifier; 1472 } 1473 else if (name.equals("unit")) { 1474 this.unit = new CodeableConcept(); 1475 return this.unit; 1476 } 1477 else if (name.equals("source")) { 1478 this.source = new Reference(); 1479 return this.source; 1480 } 1481 else if (name.equals("parent")) { 1482 this.parent = new Reference(); 1483 return this.parent; 1484 } 1485 else if (name.equals("operationalStatus")) { 1486 throw new FHIRException("Cannot call addChild on a primitive type DeviceMetric.operationalStatus"); 1487 } 1488 else if (name.equals("color")) { 1489 throw new FHIRException("Cannot call addChild on a primitive type DeviceMetric.color"); 1490 } 1491 else if (name.equals("category")) { 1492 throw new FHIRException("Cannot call addChild on a primitive type DeviceMetric.category"); 1493 } 1494 else if (name.equals("measurementPeriod")) { 1495 this.measurementPeriod = new Timing(); 1496 return this.measurementPeriod; 1497 } 1498 else if (name.equals("calibration")) { 1499 return addCalibration(); 1500 } 1501 else 1502 return super.addChild(name); 1503 } 1504 1505 public String fhirType() { 1506 return "DeviceMetric"; 1507 1508 } 1509 1510 public DeviceMetric copy() { 1511 DeviceMetric dst = new DeviceMetric(); 1512 copyValues(dst); 1513 dst.type = type == null ? null : type.copy(); 1514 dst.identifier = identifier == null ? null : identifier.copy(); 1515 dst.unit = unit == null ? null : unit.copy(); 1516 dst.source = source == null ? null : source.copy(); 1517 dst.parent = parent == null ? null : parent.copy(); 1518 dst.operationalStatus = operationalStatus == null ? null : operationalStatus.copy(); 1519 dst.color = color == null ? null : color.copy(); 1520 dst.category = category == null ? null : category.copy(); 1521 dst.measurementPeriod = measurementPeriod == null ? null : measurementPeriod.copy(); 1522 if (calibration != null) { 1523 dst.calibration = new ArrayList<DeviceMetricCalibrationComponent>(); 1524 for (DeviceMetricCalibrationComponent i : calibration) 1525 dst.calibration.add(i.copy()); 1526 }; 1527 return dst; 1528 } 1529 1530 protected DeviceMetric typedCopy() { 1531 return copy(); 1532 } 1533 1534 @Override 1535 public boolean equalsDeep(Base other) { 1536 if (!super.equalsDeep(other)) 1537 return false; 1538 if (!(other instanceof DeviceMetric)) 1539 return false; 1540 DeviceMetric o = (DeviceMetric) other; 1541 return compareDeep(type, o.type, true) && compareDeep(identifier, o.identifier, true) && compareDeep(unit, o.unit, true) 1542 && compareDeep(source, o.source, true) && compareDeep(parent, o.parent, true) && compareDeep(operationalStatus, o.operationalStatus, true) 1543 && compareDeep(color, o.color, true) && compareDeep(category, o.category, true) && compareDeep(measurementPeriod, o.measurementPeriod, true) 1544 && compareDeep(calibration, o.calibration, true); 1545 } 1546 1547 @Override 1548 public boolean equalsShallow(Base other) { 1549 if (!super.equalsShallow(other)) 1550 return false; 1551 if (!(other instanceof DeviceMetric)) 1552 return false; 1553 DeviceMetric o = (DeviceMetric) other; 1554 return compareValues(operationalStatus, o.operationalStatus, true) && compareValues(color, o.color, true) 1555 && compareValues(category, o.category, true); 1556 } 1557 1558 public boolean isEmpty() { 1559 return super.isEmpty() && (type == null || type.isEmpty()) && (identifier == null || identifier.isEmpty()) 1560 && (unit == null || unit.isEmpty()) && (source == null || source.isEmpty()) && (parent == null || parent.isEmpty()) 1561 && (operationalStatus == null || operationalStatus.isEmpty()) && (color == null || color.isEmpty()) 1562 && (category == null || category.isEmpty()) && (measurementPeriod == null || measurementPeriod.isEmpty()) 1563 && (calibration == null || calibration.isEmpty()); 1564 } 1565 1566 @Override 1567 public ResourceType getResourceType() { 1568 return ResourceType.DeviceMetric; 1569 } 1570 1571 @SearchParamDefinition(name="parent", path="DeviceMetric.parent", description="The parent DeviceMetric resource", type="reference" ) 1572 public static final String SP_PARENT = "parent"; 1573 @SearchParamDefinition(name="identifier", path="DeviceMetric.identifier", description="The identifier of the metric", type="token" ) 1574 public static final String SP_IDENTIFIER = "identifier"; 1575 @SearchParamDefinition(name="source", path="DeviceMetric.source", description="The device resource", type="reference" ) 1576 public static final String SP_SOURCE = "source"; 1577 @SearchParamDefinition(name="type", path="DeviceMetric.type", description="The component type", type="token" ) 1578 public static final String SP_TYPE = "type"; 1579 @SearchParamDefinition(name="category", path="DeviceMetric.category", description="The category of the metric", type="token" ) 1580 public static final String SP_CATEGORY = "category"; 1581 1582}