001package org.hl7.fhir.instance.model; 002 003/* 004 Copyright (c) 2011+, HL7, Inc. 005 All rights reserved. 006 007 Redistribution and use in source and binary forms, with or without modification, 008 are permitted provided that the following conditions are met: 009 010 * Redistributions of source code must retain the above copyright notice, this 011 list of conditions and the following disclaimer. 012 * Redistributions in binary form must reproduce the above copyright notice, 013 this list of conditions and the following disclaimer in the documentation 014 and/or other materials provided with the distribution. 015 * Neither the name of HL7 nor the names of its contributors may be used to 016 endorse or promote products derived from this software without specific 017 prior written permission. 018 019 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 020 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 021 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 022 IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 023 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 024 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 025 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 026 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 027 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 028 POSSIBILITY OF SUCH DAMAGE. 029 030*/ 031 032// Generated on Wed, Jul 13, 2016 05:32+1000 for FHIR v1.0.2 033import java.util.*; 034 035import org.hl7.fhir.exceptions.FHIRException; 036import org.hl7.fhir.instance.model.api.IBaseBackboneElement; 037import org.hl7.fhir.utilities.Utilities; 038 039import ca.uhn.fhir.model.api.annotation.*; 040/** 041 * Measurements and simple assertions made about a patient, device or other subject. 042 */ 043@ResourceDef(name="Observation", profile="http://hl7.org/fhir/Profile/Observation") 044public class Observation extends DomainResource { 045 046 public enum ObservationStatus { 047 /** 048 * The existence of the observation is registered, but there is no result yet available. 049 */ 050 REGISTERED, 051 /** 052 * This is an initial or interim observation: data may be incomplete or unverified. 053 */ 054 PRELIMINARY, 055 /** 056 * The observation is complete and verified by an authorized person. 057 */ 058 FINAL, 059 /** 060 * The observation has been modified subsequent to being Final, and is complete and verified by an authorized person. 061 */ 062 AMENDED, 063 /** 064 * The observation is unavailable because the measurement was not started or not completed (also sometimes called "aborted"). 065 */ 066 CANCELLED, 067 /** 068 * The observation has been withdrawn following previous final release. 069 */ 070 ENTEREDINERROR, 071 /** 072 * The observation status is unknown. Note that "unknown" is a value of last resort and every attempt should be made to provide a meaningful value other than "unknown". 073 */ 074 UNKNOWN, 075 /** 076 * added to help the parsers 077 */ 078 NULL; 079 public static ObservationStatus fromCode(String codeString) throws FHIRException { 080 if (codeString == null || "".equals(codeString)) 081 return null; 082 if ("registered".equals(codeString)) 083 return REGISTERED; 084 if ("preliminary".equals(codeString)) 085 return PRELIMINARY; 086 if ("final".equals(codeString)) 087 return FINAL; 088 if ("amended".equals(codeString)) 089 return AMENDED; 090 if ("cancelled".equals(codeString)) 091 return CANCELLED; 092 if ("entered-in-error".equals(codeString)) 093 return ENTEREDINERROR; 094 if ("unknown".equals(codeString)) 095 return UNKNOWN; 096 throw new FHIRException("Unknown ObservationStatus code '"+codeString+"'"); 097 } 098 public String toCode() { 099 switch (this) { 100 case REGISTERED: return "registered"; 101 case PRELIMINARY: return "preliminary"; 102 case FINAL: return "final"; 103 case AMENDED: return "amended"; 104 case CANCELLED: return "cancelled"; 105 case ENTEREDINERROR: return "entered-in-error"; 106 case UNKNOWN: return "unknown"; 107 default: return "?"; 108 } 109 } 110 public String getSystem() { 111 switch (this) { 112 case REGISTERED: return "http://hl7.org/fhir/observation-status"; 113 case PRELIMINARY: return "http://hl7.org/fhir/observation-status"; 114 case FINAL: return "http://hl7.org/fhir/observation-status"; 115 case AMENDED: return "http://hl7.org/fhir/observation-status"; 116 case CANCELLED: return "http://hl7.org/fhir/observation-status"; 117 case ENTEREDINERROR: return "http://hl7.org/fhir/observation-status"; 118 case UNKNOWN: return "http://hl7.org/fhir/observation-status"; 119 default: return "?"; 120 } 121 } 122 public String getDefinition() { 123 switch (this) { 124 case REGISTERED: return "The existence of the observation is registered, but there is no result yet available."; 125 case PRELIMINARY: return "This is an initial or interim observation: data may be incomplete or unverified."; 126 case FINAL: return "The observation is complete and verified by an authorized person."; 127 case AMENDED: return "The observation has been modified subsequent to being Final, and is complete and verified by an authorized person."; 128 case CANCELLED: return "The observation is unavailable because the measurement was not started or not completed (also sometimes called \"aborted\")."; 129 case ENTEREDINERROR: return "The observation has been withdrawn following previous final release."; 130 case UNKNOWN: return "The observation status is unknown. Note that \"unknown\" is a value of last resort and every attempt should be made to provide a meaningful value other than \"unknown\"."; 131 default: return "?"; 132 } 133 } 134 public String getDisplay() { 135 switch (this) { 136 case REGISTERED: return "Registered"; 137 case PRELIMINARY: return "Preliminary"; 138 case FINAL: return "Final"; 139 case AMENDED: return "Amended"; 140 case CANCELLED: return "cancelled"; 141 case ENTEREDINERROR: return "Entered in Error"; 142 case UNKNOWN: return "Unknown Status"; 143 default: return "?"; 144 } 145 } 146 } 147 148 public static class ObservationStatusEnumFactory implements EnumFactory<ObservationStatus> { 149 public ObservationStatus fromCode(String codeString) throws IllegalArgumentException { 150 if (codeString == null || "".equals(codeString)) 151 if (codeString == null || "".equals(codeString)) 152 return null; 153 if ("registered".equals(codeString)) 154 return ObservationStatus.REGISTERED; 155 if ("preliminary".equals(codeString)) 156 return ObservationStatus.PRELIMINARY; 157 if ("final".equals(codeString)) 158 return ObservationStatus.FINAL; 159 if ("amended".equals(codeString)) 160 return ObservationStatus.AMENDED; 161 if ("cancelled".equals(codeString)) 162 return ObservationStatus.CANCELLED; 163 if ("entered-in-error".equals(codeString)) 164 return ObservationStatus.ENTEREDINERROR; 165 if ("unknown".equals(codeString)) 166 return ObservationStatus.UNKNOWN; 167 throw new IllegalArgumentException("Unknown ObservationStatus code '"+codeString+"'"); 168 } 169 public Enumeration<ObservationStatus> fromType(Base code) throws FHIRException { 170 if (code == null || code.isEmpty()) 171 return null; 172 String codeString = ((PrimitiveType) code).asStringValue(); 173 if (codeString == null || "".equals(codeString)) 174 return null; 175 if ("registered".equals(codeString)) 176 return new Enumeration<ObservationStatus>(this, ObservationStatus.REGISTERED); 177 if ("preliminary".equals(codeString)) 178 return new Enumeration<ObservationStatus>(this, ObservationStatus.PRELIMINARY); 179 if ("final".equals(codeString)) 180 return new Enumeration<ObservationStatus>(this, ObservationStatus.FINAL); 181 if ("amended".equals(codeString)) 182 return new Enumeration<ObservationStatus>(this, ObservationStatus.AMENDED); 183 if ("cancelled".equals(codeString)) 184 return new Enumeration<ObservationStatus>(this, ObservationStatus.CANCELLED); 185 if ("entered-in-error".equals(codeString)) 186 return new Enumeration<ObservationStatus>(this, ObservationStatus.ENTEREDINERROR); 187 if ("unknown".equals(codeString)) 188 return new Enumeration<ObservationStatus>(this, ObservationStatus.UNKNOWN); 189 throw new FHIRException("Unknown ObservationStatus code '"+codeString+"'"); 190 } 191 public String toCode(ObservationStatus code) { 192 if (code == ObservationStatus.REGISTERED) 193 return "registered"; 194 if (code == ObservationStatus.PRELIMINARY) 195 return "preliminary"; 196 if (code == ObservationStatus.FINAL) 197 return "final"; 198 if (code == ObservationStatus.AMENDED) 199 return "amended"; 200 if (code == ObservationStatus.CANCELLED) 201 return "cancelled"; 202 if (code == ObservationStatus.ENTEREDINERROR) 203 return "entered-in-error"; 204 if (code == ObservationStatus.UNKNOWN) 205 return "unknown"; 206 return "?"; 207 } 208 } 209 210 public enum ObservationRelationshipType { 211 /** 212 * This observation is a group observation (e.g. a battery, a panel of tests, a set of vital sign measurements) that includes the target as a member of the group. 213 */ 214 HASMEMBER, 215 /** 216 * The target resource (Observation or QuestionnaireResponse) is part of the information from which this observation value is derived. (e.g. calculated anion gap, Apgar score) NOTE: "derived-from" is only logical choice when referencing QuestionnaireResponse. 217 */ 218 DERIVEDFROM, 219 /** 220 * This observation follows the target observation (e.g. timed tests such as Glucose Tolerance Test). 221 */ 222 SEQUELTO, 223 /** 224 * This observation replaces a previous observation (i.e. a revised value). The target observation is now obsolete. 225 */ 226 REPLACES, 227 /** 228 * The value of the target observation qualifies (refines) the semantics of the source observation (e.g. a lipemia measure target from a plasma measure). 229 */ 230 QUALIFIEDBY, 231 /** 232 * The value of the target observation interferes (degrades quality, or prevents valid observation) with the semantics of the source observation (e.g. a hemolysis measure target from a plasma potassium measure which has no value). 233 */ 234 INTERFEREDBY, 235 /** 236 * added to help the parsers 237 */ 238 NULL; 239 public static ObservationRelationshipType fromCode(String codeString) throws FHIRException { 240 if (codeString == null || "".equals(codeString)) 241 return null; 242 if ("has-member".equals(codeString)) 243 return HASMEMBER; 244 if ("derived-from".equals(codeString)) 245 return DERIVEDFROM; 246 if ("sequel-to".equals(codeString)) 247 return SEQUELTO; 248 if ("replaces".equals(codeString)) 249 return REPLACES; 250 if ("qualified-by".equals(codeString)) 251 return QUALIFIEDBY; 252 if ("interfered-by".equals(codeString)) 253 return INTERFEREDBY; 254 throw new FHIRException("Unknown ObservationRelationshipType code '"+codeString+"'"); 255 } 256 public String toCode() { 257 switch (this) { 258 case HASMEMBER: return "has-member"; 259 case DERIVEDFROM: return "derived-from"; 260 case SEQUELTO: return "sequel-to"; 261 case REPLACES: return "replaces"; 262 case QUALIFIEDBY: return "qualified-by"; 263 case INTERFEREDBY: return "interfered-by"; 264 default: return "?"; 265 } 266 } 267 public String getSystem() { 268 switch (this) { 269 case HASMEMBER: return "http://hl7.org/fhir/observation-relationshiptypes"; 270 case DERIVEDFROM: return "http://hl7.org/fhir/observation-relationshiptypes"; 271 case SEQUELTO: return "http://hl7.org/fhir/observation-relationshiptypes"; 272 case REPLACES: return "http://hl7.org/fhir/observation-relationshiptypes"; 273 case QUALIFIEDBY: return "http://hl7.org/fhir/observation-relationshiptypes"; 274 case INTERFEREDBY: return "http://hl7.org/fhir/observation-relationshiptypes"; 275 default: return "?"; 276 } 277 } 278 public String getDefinition() { 279 switch (this) { 280 case HASMEMBER: return "This observation is a group observation (e.g. a battery, a panel of tests, a set of vital sign measurements) that includes the target as a member of the group."; 281 case DERIVEDFROM: return "The target resource (Observation or QuestionnaireResponse) is part of the information from which this observation value is derived. (e.g. calculated anion gap, Apgar score) NOTE: \"derived-from\" is only logical choice when referencing QuestionnaireResponse."; 282 case SEQUELTO: return "This observation follows the target observation (e.g. timed tests such as Glucose Tolerance Test)."; 283 case REPLACES: return "This observation replaces a previous observation (i.e. a revised value). The target observation is now obsolete."; 284 case QUALIFIEDBY: return "The value of the target observation qualifies (refines) the semantics of the source observation (e.g. a lipemia measure target from a plasma measure)."; 285 case INTERFEREDBY: return "The value of the target observation interferes (degrades quality, or prevents valid observation) with the semantics of the source observation (e.g. a hemolysis measure target from a plasma potassium measure which has no value)."; 286 default: return "?"; 287 } 288 } 289 public String getDisplay() { 290 switch (this) { 291 case HASMEMBER: return "Has Member"; 292 case DERIVEDFROM: return "Derived From"; 293 case SEQUELTO: return "Sequel To"; 294 case REPLACES: return "Replaces"; 295 case QUALIFIEDBY: return "Qualified By"; 296 case INTERFEREDBY: return "Interfered By"; 297 default: return "?"; 298 } 299 } 300 } 301 302 public static class ObservationRelationshipTypeEnumFactory implements EnumFactory<ObservationRelationshipType> { 303 public ObservationRelationshipType fromCode(String codeString) throws IllegalArgumentException { 304 if (codeString == null || "".equals(codeString)) 305 if (codeString == null || "".equals(codeString)) 306 return null; 307 if ("has-member".equals(codeString)) 308 return ObservationRelationshipType.HASMEMBER; 309 if ("derived-from".equals(codeString)) 310 return ObservationRelationshipType.DERIVEDFROM; 311 if ("sequel-to".equals(codeString)) 312 return ObservationRelationshipType.SEQUELTO; 313 if ("replaces".equals(codeString)) 314 return ObservationRelationshipType.REPLACES; 315 if ("qualified-by".equals(codeString)) 316 return ObservationRelationshipType.QUALIFIEDBY; 317 if ("interfered-by".equals(codeString)) 318 return ObservationRelationshipType.INTERFEREDBY; 319 throw new IllegalArgumentException("Unknown ObservationRelationshipType code '"+codeString+"'"); 320 } 321 public Enumeration<ObservationRelationshipType> fromType(Base code) throws FHIRException { 322 if (code == null || code.isEmpty()) 323 return null; 324 String codeString = ((PrimitiveType) code).asStringValue(); 325 if (codeString == null || "".equals(codeString)) 326 return null; 327 if ("has-member".equals(codeString)) 328 return new Enumeration<ObservationRelationshipType>(this, ObservationRelationshipType.HASMEMBER); 329 if ("derived-from".equals(codeString)) 330 return new Enumeration<ObservationRelationshipType>(this, ObservationRelationshipType.DERIVEDFROM); 331 if ("sequel-to".equals(codeString)) 332 return new Enumeration<ObservationRelationshipType>(this, ObservationRelationshipType.SEQUELTO); 333 if ("replaces".equals(codeString)) 334 return new Enumeration<ObservationRelationshipType>(this, ObservationRelationshipType.REPLACES); 335 if ("qualified-by".equals(codeString)) 336 return new Enumeration<ObservationRelationshipType>(this, ObservationRelationshipType.QUALIFIEDBY); 337 if ("interfered-by".equals(codeString)) 338 return new Enumeration<ObservationRelationshipType>(this, ObservationRelationshipType.INTERFEREDBY); 339 throw new FHIRException("Unknown ObservationRelationshipType code '"+codeString+"'"); 340 } 341 public String toCode(ObservationRelationshipType code) { 342 if (code == ObservationRelationshipType.HASMEMBER) 343 return "has-member"; 344 if (code == ObservationRelationshipType.DERIVEDFROM) 345 return "derived-from"; 346 if (code == ObservationRelationshipType.SEQUELTO) 347 return "sequel-to"; 348 if (code == ObservationRelationshipType.REPLACES) 349 return "replaces"; 350 if (code == ObservationRelationshipType.QUALIFIEDBY) 351 return "qualified-by"; 352 if (code == ObservationRelationshipType.INTERFEREDBY) 353 return "interfered-by"; 354 return "?"; 355 } 356 } 357 358 @Block() 359 public static class ObservationReferenceRangeComponent extends BackboneElement implements IBaseBackboneElement { 360 /** 361 * The value of the low bound of the reference range. The low bound of the reference range endpoint is inclusive of the value (e.g. reference range is >=5 - <=9). If the low bound is omitted, it is assumed to be meaningless (e.g. reference range is <=2.3). 362 */ 363 @Child(name = "low", type = {SimpleQuantity.class}, order=1, min=0, max=1, modifier=false, summary=false) 364 @Description(shortDefinition="Low Range, if relevant", formalDefinition="The value of the low bound of the reference range. The low bound of the reference range endpoint is inclusive of the value (e.g. reference range is >=5 - <=9). If the low bound is omitted, it is assumed to be meaningless (e.g. reference range is <=2.3)." ) 365 protected SimpleQuantity low; 366 367 /** 368 * The value of the high bound of the reference range. The high bound of the reference range endpoint is inclusive of the value (e.g. reference range is >=5 - <=9). If the high bound is omitted, it is assumed to be meaningless (e.g. reference range is >= 2.3). 369 */ 370 @Child(name = "high", type = {SimpleQuantity.class}, order=2, min=0, max=1, modifier=false, summary=false) 371 @Description(shortDefinition="High Range, if relevant", formalDefinition="The value of the high bound of the reference range. The high bound of the reference range endpoint is inclusive of the value (e.g. reference range is >=5 - <=9). If the high bound is omitted, it is assumed to be meaningless (e.g. reference range is >= 2.3)." ) 372 protected SimpleQuantity high; 373 374 /** 375 * Code for the meaning of the reference range. 376 */ 377 @Child(name = "meaning", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=false) 378 @Description(shortDefinition="Indicates the meaning/use of this range of this range", formalDefinition="Code for the meaning of the reference range." ) 379 protected CodeableConcept meaning; 380 381 /** 382 * The age at which this reference range is applicable. This is a neonatal age (e.g. number of weeks at term) if the meaning says so. 383 */ 384 @Child(name = "age", type = {Range.class}, order=4, min=0, max=1, modifier=false, summary=false) 385 @Description(shortDefinition="Applicable age range, if relevant", formalDefinition="The age at which this reference range is applicable. This is a neonatal age (e.g. number of weeks at term) if the meaning says so." ) 386 protected Range age; 387 388 /** 389 * Text based reference range in an observation which may be used when a quantitative range is not appropriate for an observation. An example would be a reference value of "Negative" or a list or table of 'normals'. 390 */ 391 @Child(name = "text", type = {StringType.class}, order=5, min=0, max=1, modifier=false, summary=false) 392 @Description(shortDefinition="Text based reference range in an observation", formalDefinition="Text based reference range in an observation which may be used when a quantitative range is not appropriate for an observation. An example would be a reference value of \"Negative\" or a list or table of 'normals'." ) 393 protected StringType text; 394 395 private static final long serialVersionUID = -238694788L; 396 397 /* 398 * Constructor 399 */ 400 public ObservationReferenceRangeComponent() { 401 super(); 402 } 403 404 /** 405 * @return {@link #low} (The value of the low bound of the reference range. The low bound of the reference range endpoint is inclusive of the value (e.g. reference range is >=5 - <=9). If the low bound is omitted, it is assumed to be meaningless (e.g. reference range is <=2.3).) 406 */ 407 public SimpleQuantity getLow() { 408 if (this.low == null) 409 if (Configuration.errorOnAutoCreate()) 410 throw new Error("Attempt to auto-create ObservationReferenceRangeComponent.low"); 411 else if (Configuration.doAutoCreate()) 412 this.low = new SimpleQuantity(); // cc 413 return this.low; 414 } 415 416 public boolean hasLow() { 417 return this.low != null && !this.low.isEmpty(); 418 } 419 420 /** 421 * @param value {@link #low} (The value of the low bound of the reference range. The low bound of the reference range endpoint is inclusive of the value (e.g. reference range is >=5 - <=9). If the low bound is omitted, it is assumed to be meaningless (e.g. reference range is <=2.3).) 422 */ 423 public ObservationReferenceRangeComponent setLow(SimpleQuantity value) { 424 this.low = value; 425 return this; 426 } 427 428 /** 429 * @return {@link #high} (The value of the high bound of the reference range. The high bound of the reference range endpoint is inclusive of the value (e.g. reference range is >=5 - <=9). If the high bound is omitted, it is assumed to be meaningless (e.g. reference range is >= 2.3).) 430 */ 431 public SimpleQuantity getHigh() { 432 if (this.high == null) 433 if (Configuration.errorOnAutoCreate()) 434 throw new Error("Attempt to auto-create ObservationReferenceRangeComponent.high"); 435 else if (Configuration.doAutoCreate()) 436 this.high = new SimpleQuantity(); // cc 437 return this.high; 438 } 439 440 public boolean hasHigh() { 441 return this.high != null && !this.high.isEmpty(); 442 } 443 444 /** 445 * @param value {@link #high} (The value of the high bound of the reference range. The high bound of the reference range endpoint is inclusive of the value (e.g. reference range is >=5 - <=9). If the high bound is omitted, it is assumed to be meaningless (e.g. reference range is >= 2.3).) 446 */ 447 public ObservationReferenceRangeComponent setHigh(SimpleQuantity value) { 448 this.high = value; 449 return this; 450 } 451 452 /** 453 * @return {@link #meaning} (Code for the meaning of the reference range.) 454 */ 455 public CodeableConcept getMeaning() { 456 if (this.meaning == null) 457 if (Configuration.errorOnAutoCreate()) 458 throw new Error("Attempt to auto-create ObservationReferenceRangeComponent.meaning"); 459 else if (Configuration.doAutoCreate()) 460 this.meaning = new CodeableConcept(); // cc 461 return this.meaning; 462 } 463 464 public boolean hasMeaning() { 465 return this.meaning != null && !this.meaning.isEmpty(); 466 } 467 468 /** 469 * @param value {@link #meaning} (Code for the meaning of the reference range.) 470 */ 471 public ObservationReferenceRangeComponent setMeaning(CodeableConcept value) { 472 this.meaning = value; 473 return this; 474 } 475 476 /** 477 * @return {@link #age} (The age at which this reference range is applicable. This is a neonatal age (e.g. number of weeks at term) if the meaning says so.) 478 */ 479 public Range getAge() { 480 if (this.age == null) 481 if (Configuration.errorOnAutoCreate()) 482 throw new Error("Attempt to auto-create ObservationReferenceRangeComponent.age"); 483 else if (Configuration.doAutoCreate()) 484 this.age = new Range(); // cc 485 return this.age; 486 } 487 488 public boolean hasAge() { 489 return this.age != null && !this.age.isEmpty(); 490 } 491 492 /** 493 * @param value {@link #age} (The age at which this reference range is applicable. This is a neonatal age (e.g. number of weeks at term) if the meaning says so.) 494 */ 495 public ObservationReferenceRangeComponent setAge(Range value) { 496 this.age = value; 497 return this; 498 } 499 500 /** 501 * @return {@link #text} (Text based reference range in an observation which may be used when a quantitative range is not appropriate for an observation. An example would be a reference value of "Negative" or a list or table of 'normals'.). This is the underlying object with id, value and extensions. The accessor "getText" gives direct access to the value 502 */ 503 public StringType getTextElement() { 504 if (this.text == null) 505 if (Configuration.errorOnAutoCreate()) 506 throw new Error("Attempt to auto-create ObservationReferenceRangeComponent.text"); 507 else if (Configuration.doAutoCreate()) 508 this.text = new StringType(); // bb 509 return this.text; 510 } 511 512 public boolean hasTextElement() { 513 return this.text != null && !this.text.isEmpty(); 514 } 515 516 public boolean hasText() { 517 return this.text != null && !this.text.isEmpty(); 518 } 519 520 /** 521 * @param value {@link #text} (Text based reference range in an observation which may be used when a quantitative range is not appropriate for an observation. An example would be a reference value of "Negative" or a list or table of 'normals'.). This is the underlying object with id, value and extensions. The accessor "getText" gives direct access to the value 522 */ 523 public ObservationReferenceRangeComponent setTextElement(StringType value) { 524 this.text = value; 525 return this; 526 } 527 528 /** 529 * @return Text based reference range in an observation which may be used when a quantitative range is not appropriate for an observation. An example would be a reference value of "Negative" or a list or table of 'normals'. 530 */ 531 public String getText() { 532 return this.text == null ? null : this.text.getValue(); 533 } 534 535 /** 536 * @param value Text based reference range in an observation which may be used when a quantitative range is not appropriate for an observation. An example would be a reference value of "Negative" or a list or table of 'normals'. 537 */ 538 public ObservationReferenceRangeComponent setText(String value) { 539 if (Utilities.noString(value)) 540 this.text = null; 541 else { 542 if (this.text == null) 543 this.text = new StringType(); 544 this.text.setValue(value); 545 } 546 return this; 547 } 548 549 protected void listChildren(List<Property> childrenList) { 550 super.listChildren(childrenList); 551 childrenList.add(new Property("low", "SimpleQuantity", "The value of the low bound of the reference range. The low bound of the reference range endpoint is inclusive of the value (e.g. reference range is >=5 - <=9). If the low bound is omitted, it is assumed to be meaningless (e.g. reference range is <=2.3).", 0, java.lang.Integer.MAX_VALUE, low)); 552 childrenList.add(new Property("high", "SimpleQuantity", "The value of the high bound of the reference range. The high bound of the reference range endpoint is inclusive of the value (e.g. reference range is >=5 - <=9). If the high bound is omitted, it is assumed to be meaningless (e.g. reference range is >= 2.3).", 0, java.lang.Integer.MAX_VALUE, high)); 553 childrenList.add(new Property("meaning", "CodeableConcept", "Code for the meaning of the reference range.", 0, java.lang.Integer.MAX_VALUE, meaning)); 554 childrenList.add(new Property("age", "Range", "The age at which this reference range is applicable. This is a neonatal age (e.g. number of weeks at term) if the meaning says so.", 0, java.lang.Integer.MAX_VALUE, age)); 555 childrenList.add(new Property("text", "string", "Text based reference range in an observation which may be used when a quantitative range is not appropriate for an observation. An example would be a reference value of \"Negative\" or a list or table of 'normals'.", 0, java.lang.Integer.MAX_VALUE, text)); 556 } 557 558 @Override 559 public void setProperty(String name, Base value) throws FHIRException { 560 if (name.equals("low")) 561 this.low = castToSimpleQuantity(value); // SimpleQuantity 562 else if (name.equals("high")) 563 this.high = castToSimpleQuantity(value); // SimpleQuantity 564 else if (name.equals("meaning")) 565 this.meaning = castToCodeableConcept(value); // CodeableConcept 566 else if (name.equals("age")) 567 this.age = castToRange(value); // Range 568 else if (name.equals("text")) 569 this.text = castToString(value); // StringType 570 else 571 super.setProperty(name, value); 572 } 573 574 @Override 575 public Base addChild(String name) throws FHIRException { 576 if (name.equals("low")) { 577 this.low = new SimpleQuantity(); 578 return this.low; 579 } 580 else if (name.equals("high")) { 581 this.high = new SimpleQuantity(); 582 return this.high; 583 } 584 else if (name.equals("meaning")) { 585 this.meaning = new CodeableConcept(); 586 return this.meaning; 587 } 588 else if (name.equals("age")) { 589 this.age = new Range(); 590 return this.age; 591 } 592 else if (name.equals("text")) { 593 throw new FHIRException("Cannot call addChild on a primitive type Observation.text"); 594 } 595 else 596 return super.addChild(name); 597 } 598 599 public ObservationReferenceRangeComponent copy() { 600 ObservationReferenceRangeComponent dst = new ObservationReferenceRangeComponent(); 601 copyValues(dst); 602 dst.low = low == null ? null : low.copy(); 603 dst.high = high == null ? null : high.copy(); 604 dst.meaning = meaning == null ? null : meaning.copy(); 605 dst.age = age == null ? null : age.copy(); 606 dst.text = text == null ? null : text.copy(); 607 return dst; 608 } 609 610 @Override 611 public boolean equalsDeep(Base other) { 612 if (!super.equalsDeep(other)) 613 return false; 614 if (!(other instanceof ObservationReferenceRangeComponent)) 615 return false; 616 ObservationReferenceRangeComponent o = (ObservationReferenceRangeComponent) other; 617 return compareDeep(low, o.low, true) && compareDeep(high, o.high, true) && compareDeep(meaning, o.meaning, true) 618 && compareDeep(age, o.age, true) && compareDeep(text, o.text, true); 619 } 620 621 @Override 622 public boolean equalsShallow(Base other) { 623 if (!super.equalsShallow(other)) 624 return false; 625 if (!(other instanceof ObservationReferenceRangeComponent)) 626 return false; 627 ObservationReferenceRangeComponent o = (ObservationReferenceRangeComponent) other; 628 return compareValues(text, o.text, true); 629 } 630 631 public boolean isEmpty() { 632 return super.isEmpty() && (low == null || low.isEmpty()) && (high == null || high.isEmpty()) 633 && (meaning == null || meaning.isEmpty()) && (age == null || age.isEmpty()) && (text == null || text.isEmpty()) 634 ; 635 } 636 637 public String fhirType() { 638 return "Observation.referenceRange"; 639 640 } 641 642 } 643 644 @Block() 645 public static class ObservationRelatedComponent extends BackboneElement implements IBaseBackboneElement { 646 /** 647 * A code specifying the kind of relationship that exists with the target resource. 648 */ 649 @Child(name = "type", type = {CodeType.class}, order=1, min=0, max=1, modifier=false, summary=false) 650 @Description(shortDefinition="has-member | derived-from | sequel-to | replaces | qualified-by | interfered-by", formalDefinition="A code specifying the kind of relationship that exists with the target resource." ) 651 protected Enumeration<ObservationRelationshipType> type; 652 653 /** 654 * A reference to the observation or [[[QuestionnaireResponse]]] resource that is related to this observation. 655 */ 656 @Child(name = "target", type = {Observation.class, QuestionnaireResponse.class}, order=2, min=1, max=1, modifier=false, summary=false) 657 @Description(shortDefinition="Resource that is related to this one", formalDefinition="A reference to the observation or [[[QuestionnaireResponse]]] resource that is related to this observation." ) 658 protected Reference target; 659 660 /** 661 * The actual object that is the target of the reference (A reference to the observation or [[[QuestionnaireResponse]]] resource that is related to this observation.) 662 */ 663 protected Resource targetTarget; 664 665 private static final long serialVersionUID = 1541802577L; 666 667 /* 668 * Constructor 669 */ 670 public ObservationRelatedComponent() { 671 super(); 672 } 673 674 /* 675 * Constructor 676 */ 677 public ObservationRelatedComponent(Reference target) { 678 super(); 679 this.target = target; 680 } 681 682 /** 683 * @return {@link #type} (A code specifying the kind of relationship that exists with the target resource.). This is the underlying object with id, value and extensions. The accessor "getType" gives direct access to the value 684 */ 685 public Enumeration<ObservationRelationshipType> getTypeElement() { 686 if (this.type == null) 687 if (Configuration.errorOnAutoCreate()) 688 throw new Error("Attempt to auto-create ObservationRelatedComponent.type"); 689 else if (Configuration.doAutoCreate()) 690 this.type = new Enumeration<ObservationRelationshipType>(new ObservationRelationshipTypeEnumFactory()); // bb 691 return this.type; 692 } 693 694 public boolean hasTypeElement() { 695 return this.type != null && !this.type.isEmpty(); 696 } 697 698 public boolean hasType() { 699 return this.type != null && !this.type.isEmpty(); 700 } 701 702 /** 703 * @param value {@link #type} (A code specifying the kind of relationship that exists with the target resource.). This is the underlying object with id, value and extensions. The accessor "getType" gives direct access to the value 704 */ 705 public ObservationRelatedComponent setTypeElement(Enumeration<ObservationRelationshipType> value) { 706 this.type = value; 707 return this; 708 } 709 710 /** 711 * @return A code specifying the kind of relationship that exists with the target resource. 712 */ 713 public ObservationRelationshipType getType() { 714 return this.type == null ? null : this.type.getValue(); 715 } 716 717 /** 718 * @param value A code specifying the kind of relationship that exists with the target resource. 719 */ 720 public ObservationRelatedComponent setType(ObservationRelationshipType value) { 721 if (value == null) 722 this.type = null; 723 else { 724 if (this.type == null) 725 this.type = new Enumeration<ObservationRelationshipType>(new ObservationRelationshipTypeEnumFactory()); 726 this.type.setValue(value); 727 } 728 return this; 729 } 730 731 /** 732 * @return {@link #target} (A reference to the observation or [[[QuestionnaireResponse]]] resource that is related to this observation.) 733 */ 734 public Reference getTarget() { 735 if (this.target == null) 736 if (Configuration.errorOnAutoCreate()) 737 throw new Error("Attempt to auto-create ObservationRelatedComponent.target"); 738 else if (Configuration.doAutoCreate()) 739 this.target = new Reference(); // cc 740 return this.target; 741 } 742 743 public boolean hasTarget() { 744 return this.target != null && !this.target.isEmpty(); 745 } 746 747 /** 748 * @param value {@link #target} (A reference to the observation or [[[QuestionnaireResponse]]] resource that is related to this observation.) 749 */ 750 public ObservationRelatedComponent setTarget(Reference value) { 751 this.target = value; 752 return this; 753 } 754 755 /** 756 * @return {@link #target} 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. (A reference to the observation or [[[QuestionnaireResponse]]] resource that is related to this observation.) 757 */ 758 public Resource getTargetTarget() { 759 return this.targetTarget; 760 } 761 762 /** 763 * @param value {@link #target} 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. (A reference to the observation or [[[QuestionnaireResponse]]] resource that is related to this observation.) 764 */ 765 public ObservationRelatedComponent setTargetTarget(Resource value) { 766 this.targetTarget = value; 767 return this; 768 } 769 770 protected void listChildren(List<Property> childrenList) { 771 super.listChildren(childrenList); 772 childrenList.add(new Property("type", "code", "A code specifying the kind of relationship that exists with the target resource.", 0, java.lang.Integer.MAX_VALUE, type)); 773 childrenList.add(new Property("target", "Reference(Observation|QuestionnaireResponse)", "A reference to the observation or [[[QuestionnaireResponse]]] resource that is related to this observation.", 0, java.lang.Integer.MAX_VALUE, target)); 774 } 775 776 @Override 777 public void setProperty(String name, Base value) throws FHIRException { 778 if (name.equals("type")) 779 this.type = new ObservationRelationshipTypeEnumFactory().fromType(value); // Enumeration<ObservationRelationshipType> 780 else if (name.equals("target")) 781 this.target = castToReference(value); // Reference 782 else 783 super.setProperty(name, value); 784 } 785 786 @Override 787 public Base addChild(String name) throws FHIRException { 788 if (name.equals("type")) { 789 throw new FHIRException("Cannot call addChild on a primitive type Observation.type"); 790 } 791 else if (name.equals("target")) { 792 this.target = new Reference(); 793 return this.target; 794 } 795 else 796 return super.addChild(name); 797 } 798 799 public ObservationRelatedComponent copy() { 800 ObservationRelatedComponent dst = new ObservationRelatedComponent(); 801 copyValues(dst); 802 dst.type = type == null ? null : type.copy(); 803 dst.target = target == null ? null : target.copy(); 804 return dst; 805 } 806 807 @Override 808 public boolean equalsDeep(Base other) { 809 if (!super.equalsDeep(other)) 810 return false; 811 if (!(other instanceof ObservationRelatedComponent)) 812 return false; 813 ObservationRelatedComponent o = (ObservationRelatedComponent) other; 814 return compareDeep(type, o.type, true) && compareDeep(target, o.target, true); 815 } 816 817 @Override 818 public boolean equalsShallow(Base other) { 819 if (!super.equalsShallow(other)) 820 return false; 821 if (!(other instanceof ObservationRelatedComponent)) 822 return false; 823 ObservationRelatedComponent o = (ObservationRelatedComponent) other; 824 return compareValues(type, o.type, true); 825 } 826 827 public boolean isEmpty() { 828 return super.isEmpty() && (type == null || type.isEmpty()) && (target == null || target.isEmpty()) 829 ; 830 } 831 832 public String fhirType() { 833 return "Observation.related"; 834 835 } 836 837 } 838 839 @Block() 840 public static class ObservationComponentComponent extends BackboneElement implements IBaseBackboneElement { 841 /** 842 * Describes what was observed. Sometimes this is called the observation "code". 843 */ 844 @Child(name = "code", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=true) 845 @Description(shortDefinition="Type of component observation (code / type)", formalDefinition="Describes what was observed. Sometimes this is called the observation \"code\"." ) 846 protected CodeableConcept code; 847 848 /** 849 * The information determined as a result of making the observation, if the information has a simple value. 850 */ 851 @Child(name = "value", type = {Quantity.class, CodeableConcept.class, StringType.class, Range.class, Ratio.class, SampledData.class, Attachment.class, TimeType.class, DateTimeType.class, Period.class}, order=2, min=0, max=1, modifier=false, summary=true) 852 @Description(shortDefinition="Actual component result", formalDefinition="The information determined as a result of making the observation, if the information has a simple value." ) 853 protected Type value; 854 855 /** 856 * Provides a reason why the expected value in the element Observation.value[x] is missing. 857 */ 858 @Child(name = "dataAbsentReason", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=false) 859 @Description(shortDefinition="Why the component result is missing", formalDefinition="Provides a reason why the expected value in the element Observation.value[x] is missing." ) 860 protected CodeableConcept dataAbsentReason; 861 862 /** 863 * Guidance on how to interpret the value by comparison to a normal or recommended range. 864 */ 865 @Child(name = "referenceRange", type = {ObservationReferenceRangeComponent.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false) 866 @Description(shortDefinition="Provides guide for interpretation of component result", formalDefinition="Guidance on how to interpret the value by comparison to a normal or recommended range." ) 867 protected List<ObservationReferenceRangeComponent> referenceRange; 868 869 private static final long serialVersionUID = 946602904L; 870 871 /* 872 * Constructor 873 */ 874 public ObservationComponentComponent() { 875 super(); 876 } 877 878 /* 879 * Constructor 880 */ 881 public ObservationComponentComponent(CodeableConcept code) { 882 super(); 883 this.code = code; 884 } 885 886 /** 887 * @return {@link #code} (Describes what was observed. Sometimes this is called the observation "code".) 888 */ 889 public CodeableConcept getCode() { 890 if (this.code == null) 891 if (Configuration.errorOnAutoCreate()) 892 throw new Error("Attempt to auto-create ObservationComponentComponent.code"); 893 else if (Configuration.doAutoCreate()) 894 this.code = new CodeableConcept(); // cc 895 return this.code; 896 } 897 898 public boolean hasCode() { 899 return this.code != null && !this.code.isEmpty(); 900 } 901 902 /** 903 * @param value {@link #code} (Describes what was observed. Sometimes this is called the observation "code".) 904 */ 905 public ObservationComponentComponent setCode(CodeableConcept value) { 906 this.code = value; 907 return this; 908 } 909 910 /** 911 * @return {@link #value} (The information determined as a result of making the observation, if the information has a simple value.) 912 */ 913 public Type getValue() { 914 return this.value; 915 } 916 917 /** 918 * @return {@link #value} (The information determined as a result of making the observation, if the information has a simple value.) 919 */ 920 public Quantity getValueQuantity() throws FHIRException { 921 if (!(this.value instanceof Quantity)) 922 throw new FHIRException("Type mismatch: the type Quantity was expected, but "+this.value.getClass().getName()+" was encountered"); 923 return (Quantity) this.value; 924 } 925 926 public boolean hasValueQuantity() { 927 return this.value instanceof Quantity; 928 } 929 930 /** 931 * @return {@link #value} (The information determined as a result of making the observation, if the information has a simple value.) 932 */ 933 public CodeableConcept getValueCodeableConcept() throws FHIRException { 934 if (!(this.value instanceof CodeableConcept)) 935 throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.value.getClass().getName()+" was encountered"); 936 return (CodeableConcept) this.value; 937 } 938 939 public boolean hasValueCodeableConcept() { 940 return this.value instanceof CodeableConcept; 941 } 942 943 /** 944 * @return {@link #value} (The information determined as a result of making the observation, if the information has a simple value.) 945 */ 946 public StringType getValueStringType() throws FHIRException { 947 if (!(this.value instanceof StringType)) 948 throw new FHIRException("Type mismatch: the type StringType was expected, but "+this.value.getClass().getName()+" was encountered"); 949 return (StringType) this.value; 950 } 951 952 public boolean hasValueStringType() { 953 return this.value instanceof StringType; 954 } 955 956 /** 957 * @return {@link #value} (The information determined as a result of making the observation, if the information has a simple value.) 958 */ 959 public Range getValueRange() throws FHIRException { 960 if (!(this.value instanceof Range)) 961 throw new FHIRException("Type mismatch: the type Range was expected, but "+this.value.getClass().getName()+" was encountered"); 962 return (Range) this.value; 963 } 964 965 public boolean hasValueRange() { 966 return this.value instanceof Range; 967 } 968 969 /** 970 * @return {@link #value} (The information determined as a result of making the observation, if the information has a simple value.) 971 */ 972 public Ratio getValueRatio() throws FHIRException { 973 if (!(this.value instanceof Ratio)) 974 throw new FHIRException("Type mismatch: the type Ratio was expected, but "+this.value.getClass().getName()+" was encountered"); 975 return (Ratio) this.value; 976 } 977 978 public boolean hasValueRatio() { 979 return this.value instanceof Ratio; 980 } 981 982 /** 983 * @return {@link #value} (The information determined as a result of making the observation, if the information has a simple value.) 984 */ 985 public SampledData getValueSampledData() throws FHIRException { 986 if (!(this.value instanceof SampledData)) 987 throw new FHIRException("Type mismatch: the type SampledData was expected, but "+this.value.getClass().getName()+" was encountered"); 988 return (SampledData) this.value; 989 } 990 991 public boolean hasValueSampledData() { 992 return this.value instanceof SampledData; 993 } 994 995 /** 996 * @return {@link #value} (The information determined as a result of making the observation, if the information has a simple value.) 997 */ 998 public Attachment getValueAttachment() throws FHIRException { 999 if (!(this.value instanceof Attachment)) 1000 throw new FHIRException("Type mismatch: the type Attachment was expected, but "+this.value.getClass().getName()+" was encountered"); 1001 return (Attachment) this.value; 1002 } 1003 1004 public boolean hasValueAttachment() { 1005 return this.value instanceof Attachment; 1006 } 1007 1008 /** 1009 * @return {@link #value} (The information determined as a result of making the observation, if the information has a simple value.) 1010 */ 1011 public TimeType getValueTimeType() throws FHIRException { 1012 if (!(this.value instanceof TimeType)) 1013 throw new FHIRException("Type mismatch: the type TimeType was expected, but "+this.value.getClass().getName()+" was encountered"); 1014 return (TimeType) this.value; 1015 } 1016 1017 public boolean hasValueTimeType() { 1018 return this.value instanceof TimeType; 1019 } 1020 1021 /** 1022 * @return {@link #value} (The information determined as a result of making the observation, if the information has a simple value.) 1023 */ 1024 public DateTimeType getValueDateTimeType() throws FHIRException { 1025 if (!(this.value instanceof DateTimeType)) 1026 throw new FHIRException("Type mismatch: the type DateTimeType was expected, but "+this.value.getClass().getName()+" was encountered"); 1027 return (DateTimeType) this.value; 1028 } 1029 1030 public boolean hasValueDateTimeType() { 1031 return this.value instanceof DateTimeType; 1032 } 1033 1034 /** 1035 * @return {@link #value} (The information determined as a result of making the observation, if the information has a simple value.) 1036 */ 1037 public Period getValuePeriod() throws FHIRException { 1038 if (!(this.value instanceof Period)) 1039 throw new FHIRException("Type mismatch: the type Period was expected, but "+this.value.getClass().getName()+" was encountered"); 1040 return (Period) this.value; 1041 } 1042 1043 public boolean hasValuePeriod() { 1044 return this.value instanceof Period; 1045 } 1046 1047 public boolean hasValue() { 1048 return this.value != null && !this.value.isEmpty(); 1049 } 1050 1051 /** 1052 * @param value {@link #value} (The information determined as a result of making the observation, if the information has a simple value.) 1053 */ 1054 public ObservationComponentComponent setValue(Type value) { 1055 this.value = value; 1056 return this; 1057 } 1058 1059 /** 1060 * @return {@link #dataAbsentReason} (Provides a reason why the expected value in the element Observation.value[x] is missing.) 1061 */ 1062 public CodeableConcept getDataAbsentReason() { 1063 if (this.dataAbsentReason == null) 1064 if (Configuration.errorOnAutoCreate()) 1065 throw new Error("Attempt to auto-create ObservationComponentComponent.dataAbsentReason"); 1066 else if (Configuration.doAutoCreate()) 1067 this.dataAbsentReason = new CodeableConcept(); // cc 1068 return this.dataAbsentReason; 1069 } 1070 1071 public boolean hasDataAbsentReason() { 1072 return this.dataAbsentReason != null && !this.dataAbsentReason.isEmpty(); 1073 } 1074 1075 /** 1076 * @param value {@link #dataAbsentReason} (Provides a reason why the expected value in the element Observation.value[x] is missing.) 1077 */ 1078 public ObservationComponentComponent setDataAbsentReason(CodeableConcept value) { 1079 this.dataAbsentReason = value; 1080 return this; 1081 } 1082 1083 /** 1084 * @return {@link #referenceRange} (Guidance on how to interpret the value by comparison to a normal or recommended range.) 1085 */ 1086 public List<ObservationReferenceRangeComponent> getReferenceRange() { 1087 if (this.referenceRange == null) 1088 this.referenceRange = new ArrayList<ObservationReferenceRangeComponent>(); 1089 return this.referenceRange; 1090 } 1091 1092 public boolean hasReferenceRange() { 1093 if (this.referenceRange == null) 1094 return false; 1095 for (ObservationReferenceRangeComponent item : this.referenceRange) 1096 if (!item.isEmpty()) 1097 return true; 1098 return false; 1099 } 1100 1101 /** 1102 * @return {@link #referenceRange} (Guidance on how to interpret the value by comparison to a normal or recommended range.) 1103 */ 1104 // syntactic sugar 1105 public ObservationReferenceRangeComponent addReferenceRange() { //3 1106 ObservationReferenceRangeComponent t = new ObservationReferenceRangeComponent(); 1107 if (this.referenceRange == null) 1108 this.referenceRange = new ArrayList<ObservationReferenceRangeComponent>(); 1109 this.referenceRange.add(t); 1110 return t; 1111 } 1112 1113 // syntactic sugar 1114 public ObservationComponentComponent addReferenceRange(ObservationReferenceRangeComponent t) { //3 1115 if (t == null) 1116 return this; 1117 if (this.referenceRange == null) 1118 this.referenceRange = new ArrayList<ObservationReferenceRangeComponent>(); 1119 this.referenceRange.add(t); 1120 return this; 1121 } 1122 1123 protected void listChildren(List<Property> childrenList) { 1124 super.listChildren(childrenList); 1125 childrenList.add(new Property("code", "CodeableConcept", "Describes what was observed. Sometimes this is called the observation \"code\".", 0, java.lang.Integer.MAX_VALUE, code)); 1126 childrenList.add(new Property("value[x]", "Quantity|CodeableConcept|string|Range|Ratio|SampledData|Attachment|time|dateTime|Period", "The information determined as a result of making the observation, if the information has a simple value.", 0, java.lang.Integer.MAX_VALUE, value)); 1127 childrenList.add(new Property("dataAbsentReason", "CodeableConcept", "Provides a reason why the expected value in the element Observation.value[x] is missing.", 0, java.lang.Integer.MAX_VALUE, dataAbsentReason)); 1128 childrenList.add(new Property("referenceRange", "@Observation.referenceRange", "Guidance on how to interpret the value by comparison to a normal or recommended range.", 0, java.lang.Integer.MAX_VALUE, referenceRange)); 1129 } 1130 1131 @Override 1132 public void setProperty(String name, Base value) throws FHIRException { 1133 if (name.equals("code")) 1134 this.code = castToCodeableConcept(value); // CodeableConcept 1135 else if (name.equals("value[x]")) 1136 this.value = (Type) value; // Type 1137 else if (name.equals("dataAbsentReason")) 1138 this.dataAbsentReason = castToCodeableConcept(value); // CodeableConcept 1139 else if (name.equals("referenceRange")) 1140 this.getReferenceRange().add((ObservationReferenceRangeComponent) value); 1141 else 1142 super.setProperty(name, value); 1143 } 1144 1145 @Override 1146 public Base addChild(String name) throws FHIRException { 1147 if (name.equals("code")) { 1148 this.code = new CodeableConcept(); 1149 return this.code; 1150 } 1151 else if (name.equals("valueQuantity")) { 1152 this.value = new Quantity(); 1153 return this.value; 1154 } 1155 else if (name.equals("valueCodeableConcept")) { 1156 this.value = new CodeableConcept(); 1157 return this.value; 1158 } 1159 else if (name.equals("valueString")) { 1160 this.value = new StringType(); 1161 return this.value; 1162 } 1163 else if (name.equals("valueRange")) { 1164 this.value = new Range(); 1165 return this.value; 1166 } 1167 else if (name.equals("valueRatio")) { 1168 this.value = new Ratio(); 1169 return this.value; 1170 } 1171 else if (name.equals("valueSampledData")) { 1172 this.value = new SampledData(); 1173 return this.value; 1174 } 1175 else if (name.equals("valueAttachment")) { 1176 this.value = new Attachment(); 1177 return this.value; 1178 } 1179 else if (name.equals("valueTime")) { 1180 this.value = new TimeType(); 1181 return this.value; 1182 } 1183 else if (name.equals("valueDateTime")) { 1184 this.value = new DateTimeType(); 1185 return this.value; 1186 } 1187 else if (name.equals("valuePeriod")) { 1188 this.value = new Period(); 1189 return this.value; 1190 } 1191 else if (name.equals("dataAbsentReason")) { 1192 this.dataAbsentReason = new CodeableConcept(); 1193 return this.dataAbsentReason; 1194 } 1195 else if (name.equals("referenceRange")) { 1196 return addReferenceRange(); 1197 } 1198 else 1199 return super.addChild(name); 1200 } 1201 1202 public ObservationComponentComponent copy() { 1203 ObservationComponentComponent dst = new ObservationComponentComponent(); 1204 copyValues(dst); 1205 dst.code = code == null ? null : code.copy(); 1206 dst.value = value == null ? null : value.copy(); 1207 dst.dataAbsentReason = dataAbsentReason == null ? null : dataAbsentReason.copy(); 1208 if (referenceRange != null) { 1209 dst.referenceRange = new ArrayList<ObservationReferenceRangeComponent>(); 1210 for (ObservationReferenceRangeComponent i : referenceRange) 1211 dst.referenceRange.add(i.copy()); 1212 }; 1213 return dst; 1214 } 1215 1216 @Override 1217 public boolean equalsDeep(Base other) { 1218 if (!super.equalsDeep(other)) 1219 return false; 1220 if (!(other instanceof ObservationComponentComponent)) 1221 return false; 1222 ObservationComponentComponent o = (ObservationComponentComponent) other; 1223 return compareDeep(code, o.code, true) && compareDeep(value, o.value, true) && compareDeep(dataAbsentReason, o.dataAbsentReason, true) 1224 && compareDeep(referenceRange, o.referenceRange, true); 1225 } 1226 1227 @Override 1228 public boolean equalsShallow(Base other) { 1229 if (!super.equalsShallow(other)) 1230 return false; 1231 if (!(other instanceof ObservationComponentComponent)) 1232 return false; 1233 ObservationComponentComponent o = (ObservationComponentComponent) other; 1234 return true; 1235 } 1236 1237 public boolean isEmpty() { 1238 return super.isEmpty() && (code == null || code.isEmpty()) && (value == null || value.isEmpty()) 1239 && (dataAbsentReason == null || dataAbsentReason.isEmpty()) && (referenceRange == null || referenceRange.isEmpty()) 1240 ; 1241 } 1242 1243 public String fhirType() { 1244 return "Observation.component"; 1245 1246 } 1247 1248 } 1249 1250 /** 1251 * A unique identifier for the simple observation instance. 1252 */ 1253 @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false) 1254 @Description(shortDefinition="Unique Id for this particular observation", formalDefinition="A unique identifier for the simple observation instance." ) 1255 protected List<Identifier> identifier; 1256 1257 /** 1258 * The status of the result value. 1259 */ 1260 @Child(name = "status", type = {CodeType.class}, order=1, min=1, max=1, modifier=true, summary=true) 1261 @Description(shortDefinition="registered | preliminary | final | amended +", formalDefinition="The status of the result value." ) 1262 protected Enumeration<ObservationStatus> status; 1263 1264 /** 1265 * A code that classifies the general type of observation being made. This is used for searching, sorting and display purposes. 1266 */ 1267 @Child(name = "category", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false) 1268 @Description(shortDefinition="Classification of type of observation", formalDefinition="A code that classifies the general type of observation being made. This is used for searching, sorting and display purposes." ) 1269 protected CodeableConcept category; 1270 1271 /** 1272 * Describes what was observed. Sometimes this is called the observation "name". 1273 */ 1274 @Child(name = "code", type = {CodeableConcept.class}, order=3, min=1, max=1, modifier=false, summary=true) 1275 @Description(shortDefinition="Type of observation (code / type)", formalDefinition="Describes what was observed. Sometimes this is called the observation \"name\"." ) 1276 protected CodeableConcept code; 1277 1278 /** 1279 * The patient, or group of patients, location, or device whose characteristics (direct or indirect) are described by the observation and into whose record the observation is placed. Comments: Indirect characteristics may be those of a specimen, fetus, donor, other observer (for example a relative or EMT), or any observation made about the subject. 1280 */ 1281 @Child(name = "subject", type = {Patient.class, Group.class, Device.class, Location.class}, order=4, min=0, max=1, modifier=false, summary=true) 1282 @Description(shortDefinition="Who and/or what this is about", formalDefinition="The patient, or group of patients, location, or device whose characteristics (direct or indirect) are described by the observation and into whose record the observation is placed. Comments: Indirect characteristics may be those of a specimen, fetus, donor, other observer (for example a relative or EMT), or any observation made about the subject." ) 1283 protected Reference subject; 1284 1285 /** 1286 * The actual object that is the target of the reference (The patient, or group of patients, location, or device whose characteristics (direct or indirect) are described by the observation and into whose record the observation is placed. Comments: Indirect characteristics may be those of a specimen, fetus, donor, other observer (for example a relative or EMT), or any observation made about the subject.) 1287 */ 1288 protected Resource subjectTarget; 1289 1290 /** 1291 * The healthcare event (e.g. a patient and healthcare provider interaction) during which this observation is made. 1292 */ 1293 @Child(name = "encounter", type = {Encounter.class}, order=5, min=0, max=1, modifier=false, summary=false) 1294 @Description(shortDefinition="Healthcare event during which this observation is made", formalDefinition="The healthcare event (e.g. a patient and healthcare provider interaction) during which this observation is made." ) 1295 protected Reference encounter; 1296 1297 /** 1298 * The actual object that is the target of the reference (The healthcare event (e.g. a patient and healthcare provider interaction) during which this observation is made.) 1299 */ 1300 protected Encounter encounterTarget; 1301 1302 /** 1303 * The time or time-period the observed value is asserted as being true. For biological subjects - e.g. human patients - this is usually called the "physiologically relevant time". This is usually either the time of the procedure or of specimen collection, but very often the source of the date/time is not known, only the date/time itself. 1304 */ 1305 @Child(name = "effective", type = {DateTimeType.class, Period.class}, order=6, min=0, max=1, modifier=false, summary=true) 1306 @Description(shortDefinition="Clinically relevant time/time-period for observation", formalDefinition="The time or time-period the observed value is asserted as being true. For biological subjects - e.g. human patients - this is usually called the \"physiologically relevant time\". This is usually either the time of the procedure or of specimen collection, but very often the source of the date/time is not known, only the date/time itself." ) 1307 protected Type effective; 1308 1309 /** 1310 * The date and time this observation was made available to providers, typically after the results have been reviewed and verified. 1311 */ 1312 @Child(name = "issued", type = {InstantType.class}, order=7, min=0, max=1, modifier=false, summary=true) 1313 @Description(shortDefinition="Date/Time this was made available", formalDefinition="The date and time this observation was made available to providers, typically after the results have been reviewed and verified." ) 1314 protected InstantType issued; 1315 1316 /** 1317 * Who was responsible for asserting the observed value as "true". 1318 */ 1319 @Child(name = "performer", type = {Practitioner.class, Organization.class, Patient.class, RelatedPerson.class}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 1320 @Description(shortDefinition="Who is responsible for the observation", formalDefinition="Who was responsible for asserting the observed value as \"true\"." ) 1321 protected List<Reference> performer; 1322 /** 1323 * The actual objects that are the target of the reference (Who was responsible for asserting the observed value as "true".) 1324 */ 1325 protected List<Resource> performerTarget; 1326 1327 1328 /** 1329 * The information determined as a result of making the observation, if the information has a simple value. 1330 */ 1331 @Child(name = "value", type = {Quantity.class, CodeableConcept.class, StringType.class, Range.class, Ratio.class, SampledData.class, Attachment.class, TimeType.class, DateTimeType.class, Period.class}, order=9, min=0, max=1, modifier=false, summary=true) 1332 @Description(shortDefinition="Actual result", formalDefinition="The information determined as a result of making the observation, if the information has a simple value." ) 1333 protected Type value; 1334 1335 /** 1336 * Provides a reason why the expected value in the element Observation.value[x] is missing. 1337 */ 1338 @Child(name = "dataAbsentReason", type = {CodeableConcept.class}, order=10, min=0, max=1, modifier=false, summary=false) 1339 @Description(shortDefinition="Why the result is missing", formalDefinition="Provides a reason why the expected value in the element Observation.value[x] is missing." ) 1340 protected CodeableConcept dataAbsentReason; 1341 1342 /** 1343 * The assessment made based on the result of the observation. Intended as a simple compact code often placed adjacent to the result value in reports and flow sheets to signal the meaning/normalcy status of the result. Otherwise known as abnormal flag. 1344 */ 1345 @Child(name = "interpretation", type = {CodeableConcept.class}, order=11, min=0, max=1, modifier=false, summary=false) 1346 @Description(shortDefinition="High, low, normal, etc.", formalDefinition="The assessment made based on the result of the observation. Intended as a simple compact code often placed adjacent to the result value in reports and flow sheets to signal the meaning/normalcy status of the result. Otherwise known as abnormal flag." ) 1347 protected CodeableConcept interpretation; 1348 1349 /** 1350 * May include statements about significant, unexpected or unreliable values, or information about the source of the value where this may be relevant to the interpretation of the result. 1351 */ 1352 @Child(name = "comments", type = {StringType.class}, order=12, min=0, max=1, modifier=false, summary=false) 1353 @Description(shortDefinition="Comments about result", formalDefinition="May include statements about significant, unexpected or unreliable values, or information about the source of the value where this may be relevant to the interpretation of the result." ) 1354 protected StringType comments; 1355 1356 /** 1357 * Indicates the site on the subject's body where the observation was made (i.e. the target site). 1358 */ 1359 @Child(name = "bodySite", type = {CodeableConcept.class}, order=13, min=0, max=1, modifier=false, summary=false) 1360 @Description(shortDefinition="Observed body part", formalDefinition="Indicates the site on the subject's body where the observation was made (i.e. the target site)." ) 1361 protected CodeableConcept bodySite; 1362 1363 /** 1364 * Indicates the mechanism used to perform the observation. 1365 */ 1366 @Child(name = "method", type = {CodeableConcept.class}, order=14, min=0, max=1, modifier=false, summary=false) 1367 @Description(shortDefinition="How it was done", formalDefinition="Indicates the mechanism used to perform the observation." ) 1368 protected CodeableConcept method; 1369 1370 /** 1371 * The specimen that was used when this observation was made. 1372 */ 1373 @Child(name = "specimen", type = {Specimen.class}, order=15, min=0, max=1, modifier=false, summary=false) 1374 @Description(shortDefinition="Specimen used for this observation", formalDefinition="The specimen that was used when this observation was made." ) 1375 protected Reference specimen; 1376 1377 /** 1378 * The actual object that is the target of the reference (The specimen that was used when this observation was made.) 1379 */ 1380 protected Specimen specimenTarget; 1381 1382 /** 1383 * The device used to generate the observation data. 1384 */ 1385 @Child(name = "device", type = {Device.class, DeviceMetric.class}, order=16, min=0, max=1, modifier=false, summary=false) 1386 @Description(shortDefinition="(Measurement) Device", formalDefinition="The device used to generate the observation data." ) 1387 protected Reference device; 1388 1389 /** 1390 * The actual object that is the target of the reference (The device used to generate the observation data.) 1391 */ 1392 protected Resource deviceTarget; 1393 1394 /** 1395 * Guidance on how to interpret the value by comparison to a normal or recommended range. 1396 */ 1397 @Child(name = "referenceRange", type = {}, order=17, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false) 1398 @Description(shortDefinition="Provides guide for interpretation", formalDefinition="Guidance on how to interpret the value by comparison to a normal or recommended range." ) 1399 protected List<ObservationReferenceRangeComponent> referenceRange; 1400 1401 /** 1402 * A reference to another resource (usually another Observation but could also be a QuestionnaireAnswer) whose relationship is defined by the relationship type code. 1403 */ 1404 @Child(name = "related", type = {}, order=18, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 1405 @Description(shortDefinition="Resource related to this observation", formalDefinition="A reference to another resource (usually another Observation but could also be a QuestionnaireAnswer) whose relationship is defined by the relationship type code." ) 1406 protected List<ObservationRelatedComponent> related; 1407 1408 /** 1409 * Some observations have multiple component observations. These component observations are expressed as separate code value pairs that share the same attributes. Examples include systolic and diastolic component observations for blood pressure measurement and multiple component observations for genetics observations. 1410 */ 1411 @Child(name = "component", type = {}, order=19, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 1412 @Description(shortDefinition="Component results", formalDefinition="Some observations have multiple component observations. These component observations are expressed as separate code value pairs that share the same attributes. Examples include systolic and diastolic component observations for blood pressure measurement and multiple component observations for genetics observations." ) 1413 protected List<ObservationComponentComponent> component; 1414 1415 private static final long serialVersionUID = -931593572L; 1416 1417 /* 1418 * Constructor 1419 */ 1420 public Observation() { 1421 super(); 1422 } 1423 1424 /* 1425 * Constructor 1426 */ 1427 public Observation(Enumeration<ObservationStatus> status, CodeableConcept code) { 1428 super(); 1429 this.status = status; 1430 this.code = code; 1431 } 1432 1433 /** 1434 * @return {@link #identifier} (A unique identifier for the simple observation instance.) 1435 */ 1436 public List<Identifier> getIdentifier() { 1437 if (this.identifier == null) 1438 this.identifier = new ArrayList<Identifier>(); 1439 return this.identifier; 1440 } 1441 1442 public boolean hasIdentifier() { 1443 if (this.identifier == null) 1444 return false; 1445 for (Identifier item : this.identifier) 1446 if (!item.isEmpty()) 1447 return true; 1448 return false; 1449 } 1450 1451 /** 1452 * @return {@link #identifier} (A unique identifier for the simple observation instance.) 1453 */ 1454 // syntactic sugar 1455 public Identifier addIdentifier() { //3 1456 Identifier t = new Identifier(); 1457 if (this.identifier == null) 1458 this.identifier = new ArrayList<Identifier>(); 1459 this.identifier.add(t); 1460 return t; 1461 } 1462 1463 // syntactic sugar 1464 public Observation addIdentifier(Identifier t) { //3 1465 if (t == null) 1466 return this; 1467 if (this.identifier == null) 1468 this.identifier = new ArrayList<Identifier>(); 1469 this.identifier.add(t); 1470 return this; 1471 } 1472 1473 /** 1474 * @return {@link #status} (The status of the result value.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value 1475 */ 1476 public Enumeration<ObservationStatus> getStatusElement() { 1477 if (this.status == null) 1478 if (Configuration.errorOnAutoCreate()) 1479 throw new Error("Attempt to auto-create Observation.status"); 1480 else if (Configuration.doAutoCreate()) 1481 this.status = new Enumeration<ObservationStatus>(new ObservationStatusEnumFactory()); // bb 1482 return this.status; 1483 } 1484 1485 public boolean hasStatusElement() { 1486 return this.status != null && !this.status.isEmpty(); 1487 } 1488 1489 public boolean hasStatus() { 1490 return this.status != null && !this.status.isEmpty(); 1491 } 1492 1493 /** 1494 * @param value {@link #status} (The status of the result value.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value 1495 */ 1496 public Observation setStatusElement(Enumeration<ObservationStatus> value) { 1497 this.status = value; 1498 return this; 1499 } 1500 1501 /** 1502 * @return The status of the result value. 1503 */ 1504 public ObservationStatus getStatus() { 1505 return this.status == null ? null : this.status.getValue(); 1506 } 1507 1508 /** 1509 * @param value The status of the result value. 1510 */ 1511 public Observation setStatus(ObservationStatus value) { 1512 if (this.status == null) 1513 this.status = new Enumeration<ObservationStatus>(new ObservationStatusEnumFactory()); 1514 this.status.setValue(value); 1515 return this; 1516 } 1517 1518 /** 1519 * @return {@link #category} (A code that classifies the general type of observation being made. This is used for searching, sorting and display purposes.) 1520 */ 1521 public CodeableConcept getCategory() { 1522 if (this.category == null) 1523 if (Configuration.errorOnAutoCreate()) 1524 throw new Error("Attempt to auto-create Observation.category"); 1525 else if (Configuration.doAutoCreate()) 1526 this.category = new CodeableConcept(); // cc 1527 return this.category; 1528 } 1529 1530 public boolean hasCategory() { 1531 return this.category != null && !this.category.isEmpty(); 1532 } 1533 1534 /** 1535 * @param value {@link #category} (A code that classifies the general type of observation being made. This is used for searching, sorting and display purposes.) 1536 */ 1537 public Observation setCategory(CodeableConcept value) { 1538 this.category = value; 1539 return this; 1540 } 1541 1542 /** 1543 * @return {@link #code} (Describes what was observed. Sometimes this is called the observation "name".) 1544 */ 1545 public CodeableConcept getCode() { 1546 if (this.code == null) 1547 if (Configuration.errorOnAutoCreate()) 1548 throw new Error("Attempt to auto-create Observation.code"); 1549 else if (Configuration.doAutoCreate()) 1550 this.code = new CodeableConcept(); // cc 1551 return this.code; 1552 } 1553 1554 public boolean hasCode() { 1555 return this.code != null && !this.code.isEmpty(); 1556 } 1557 1558 /** 1559 * @param value {@link #code} (Describes what was observed. Sometimes this is called the observation "name".) 1560 */ 1561 public Observation setCode(CodeableConcept value) { 1562 this.code = value; 1563 return this; 1564 } 1565 1566 /** 1567 * @return {@link #subject} (The patient, or group of patients, location, or device whose characteristics (direct or indirect) are described by the observation and into whose record the observation is placed. Comments: Indirect characteristics may be those of a specimen, fetus, donor, other observer (for example a relative or EMT), or any observation made about the subject.) 1568 */ 1569 public Reference getSubject() { 1570 if (this.subject == null) 1571 if (Configuration.errorOnAutoCreate()) 1572 throw new Error("Attempt to auto-create Observation.subject"); 1573 else if (Configuration.doAutoCreate()) 1574 this.subject = new Reference(); // cc 1575 return this.subject; 1576 } 1577 1578 public boolean hasSubject() { 1579 return this.subject != null && !this.subject.isEmpty(); 1580 } 1581 1582 /** 1583 * @param value {@link #subject} (The patient, or group of patients, location, or device whose characteristics (direct or indirect) are described by the observation and into whose record the observation is placed. Comments: Indirect characteristics may be those of a specimen, fetus, donor, other observer (for example a relative or EMT), or any observation made about the subject.) 1584 */ 1585 public Observation setSubject(Reference value) { 1586 this.subject = value; 1587 return this; 1588 } 1589 1590 /** 1591 * @return {@link #subject} 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. (The patient, or group of patients, location, or device whose characteristics (direct or indirect) are described by the observation and into whose record the observation is placed. Comments: Indirect characteristics may be those of a specimen, fetus, donor, other observer (for example a relative or EMT), or any observation made about the subject.) 1592 */ 1593 public Resource getSubjectTarget() { 1594 return this.subjectTarget; 1595 } 1596 1597 /** 1598 * @param value {@link #subject} 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. (The patient, or group of patients, location, or device whose characteristics (direct or indirect) are described by the observation and into whose record the observation is placed. Comments: Indirect characteristics may be those of a specimen, fetus, donor, other observer (for example a relative or EMT), or any observation made about the subject.) 1599 */ 1600 public Observation setSubjectTarget(Resource value) { 1601 this.subjectTarget = value; 1602 return this; 1603 } 1604 1605 /** 1606 * @return {@link #encounter} (The healthcare event (e.g. a patient and healthcare provider interaction) during which this observation is made.) 1607 */ 1608 public Reference getEncounter() { 1609 if (this.encounter == null) 1610 if (Configuration.errorOnAutoCreate()) 1611 throw new Error("Attempt to auto-create Observation.encounter"); 1612 else if (Configuration.doAutoCreate()) 1613 this.encounter = new Reference(); // cc 1614 return this.encounter; 1615 } 1616 1617 public boolean hasEncounter() { 1618 return this.encounter != null && !this.encounter.isEmpty(); 1619 } 1620 1621 /** 1622 * @param value {@link #encounter} (The healthcare event (e.g. a patient and healthcare provider interaction) during which this observation is made.) 1623 */ 1624 public Observation setEncounter(Reference value) { 1625 this.encounter = value; 1626 return this; 1627 } 1628 1629 /** 1630 * @return {@link #encounter} 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. (The healthcare event (e.g. a patient and healthcare provider interaction) during which this observation is made.) 1631 */ 1632 public Encounter getEncounterTarget() { 1633 if (this.encounterTarget == null) 1634 if (Configuration.errorOnAutoCreate()) 1635 throw new Error("Attempt to auto-create Observation.encounter"); 1636 else if (Configuration.doAutoCreate()) 1637 this.encounterTarget = new Encounter(); // aa 1638 return this.encounterTarget; 1639 } 1640 1641 /** 1642 * @param value {@link #encounter} 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. (The healthcare event (e.g. a patient and healthcare provider interaction) during which this observation is made.) 1643 */ 1644 public Observation setEncounterTarget(Encounter value) { 1645 this.encounterTarget = value; 1646 return this; 1647 } 1648 1649 /** 1650 * @return {@link #effective} (The time or time-period the observed value is asserted as being true. For biological subjects - e.g. human patients - this is usually called the "physiologically relevant time". This is usually either the time of the procedure or of specimen collection, but very often the source of the date/time is not known, only the date/time itself.) 1651 */ 1652 public Type getEffective() { 1653 return this.effective; 1654 } 1655 1656 /** 1657 * @return {@link #effective} (The time or time-period the observed value is asserted as being true. For biological subjects - e.g. human patients - this is usually called the "physiologically relevant time". This is usually either the time of the procedure or of specimen collection, but very often the source of the date/time is not known, only the date/time itself.) 1658 */ 1659 public DateTimeType getEffectiveDateTimeType() throws FHIRException { 1660 if (!(this.effective instanceof DateTimeType)) 1661 throw new FHIRException("Type mismatch: the type DateTimeType was expected, but "+this.effective.getClass().getName()+" was encountered"); 1662 return (DateTimeType) this.effective; 1663 } 1664 1665 public boolean hasEffectiveDateTimeType() { 1666 return this.effective instanceof DateTimeType; 1667 } 1668 1669 /** 1670 * @return {@link #effective} (The time or time-period the observed value is asserted as being true. For biological subjects - e.g. human patients - this is usually called the "physiologically relevant time". This is usually either the time of the procedure or of specimen collection, but very often the source of the date/time is not known, only the date/time itself.) 1671 */ 1672 public Period getEffectivePeriod() throws FHIRException { 1673 if (!(this.effective instanceof Period)) 1674 throw new FHIRException("Type mismatch: the type Period was expected, but "+this.effective.getClass().getName()+" was encountered"); 1675 return (Period) this.effective; 1676 } 1677 1678 public boolean hasEffectivePeriod() { 1679 return this.effective instanceof Period; 1680 } 1681 1682 public boolean hasEffective() { 1683 return this.effective != null && !this.effective.isEmpty(); 1684 } 1685 1686 /** 1687 * @param value {@link #effective} (The time or time-period the observed value is asserted as being true. For biological subjects - e.g. human patients - this is usually called the "physiologically relevant time". This is usually either the time of the procedure or of specimen collection, but very often the source of the date/time is not known, only the date/time itself.) 1688 */ 1689 public Observation setEffective(Type value) { 1690 this.effective = value; 1691 return this; 1692 } 1693 1694 /** 1695 * @return {@link #issued} (The date and time this observation was made available to providers, typically after the results have been reviewed and verified.). This is the underlying object with id, value and extensions. The accessor "getIssued" gives direct access to the value 1696 */ 1697 public InstantType getIssuedElement() { 1698 if (this.issued == null) 1699 if (Configuration.errorOnAutoCreate()) 1700 throw new Error("Attempt to auto-create Observation.issued"); 1701 else if (Configuration.doAutoCreate()) 1702 this.issued = new InstantType(); // bb 1703 return this.issued; 1704 } 1705 1706 public boolean hasIssuedElement() { 1707 return this.issued != null && !this.issued.isEmpty(); 1708 } 1709 1710 public boolean hasIssued() { 1711 return this.issued != null && !this.issued.isEmpty(); 1712 } 1713 1714 /** 1715 * @param value {@link #issued} (The date and time this observation was made available to providers, typically after the results have been reviewed and verified.). This is the underlying object with id, value and extensions. The accessor "getIssued" gives direct access to the value 1716 */ 1717 public Observation setIssuedElement(InstantType value) { 1718 this.issued = value; 1719 return this; 1720 } 1721 1722 /** 1723 * @return The date and time this observation was made available to providers, typically after the results have been reviewed and verified. 1724 */ 1725 public Date getIssued() { 1726 return this.issued == null ? null : this.issued.getValue(); 1727 } 1728 1729 /** 1730 * @param value The date and time this observation was made available to providers, typically after the results have been reviewed and verified. 1731 */ 1732 public Observation setIssued(Date value) { 1733 if (value == null) 1734 this.issued = null; 1735 else { 1736 if (this.issued == null) 1737 this.issued = new InstantType(); 1738 this.issued.setValue(value); 1739 } 1740 return this; 1741 } 1742 1743 /** 1744 * @return {@link #performer} (Who was responsible for asserting the observed value as "true".) 1745 */ 1746 public List<Reference> getPerformer() { 1747 if (this.performer == null) 1748 this.performer = new ArrayList<Reference>(); 1749 return this.performer; 1750 } 1751 1752 public boolean hasPerformer() { 1753 if (this.performer == null) 1754 return false; 1755 for (Reference item : this.performer) 1756 if (!item.isEmpty()) 1757 return true; 1758 return false; 1759 } 1760 1761 /** 1762 * @return {@link #performer} (Who was responsible for asserting the observed value as "true".) 1763 */ 1764 // syntactic sugar 1765 public Reference addPerformer() { //3 1766 Reference t = new Reference(); 1767 if (this.performer == null) 1768 this.performer = new ArrayList<Reference>(); 1769 this.performer.add(t); 1770 return t; 1771 } 1772 1773 // syntactic sugar 1774 public Observation addPerformer(Reference t) { //3 1775 if (t == null) 1776 return this; 1777 if (this.performer == null) 1778 this.performer = new ArrayList<Reference>(); 1779 this.performer.add(t); 1780 return this; 1781 } 1782 1783 /** 1784 * @return {@link #performer} (The actual objects that are the target of the reference. The reference library doesn't populate this, but you can use this to hold the resources if you resolvethemt. Who was responsible for asserting the observed value as "true".) 1785 */ 1786 public List<Resource> getPerformerTarget() { 1787 if (this.performerTarget == null) 1788 this.performerTarget = new ArrayList<Resource>(); 1789 return this.performerTarget; 1790 } 1791 1792 /** 1793 * @return {@link #value} (The information determined as a result of making the observation, if the information has a simple value.) 1794 */ 1795 public Type getValue() { 1796 return this.value; 1797 } 1798 1799 /** 1800 * @return {@link #value} (The information determined as a result of making the observation, if the information has a simple value.) 1801 */ 1802 public Quantity getValueQuantity() throws FHIRException { 1803 if (!(this.value instanceof Quantity)) 1804 throw new FHIRException("Type mismatch: the type Quantity was expected, but "+this.value.getClass().getName()+" was encountered"); 1805 return (Quantity) this.value; 1806 } 1807 1808 public boolean hasValueQuantity() { 1809 return this.value instanceof Quantity; 1810 } 1811 1812 /** 1813 * @return {@link #value} (The information determined as a result of making the observation, if the information has a simple value.) 1814 */ 1815 public CodeableConcept getValueCodeableConcept() throws FHIRException { 1816 if (!(this.value instanceof CodeableConcept)) 1817 throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.value.getClass().getName()+" was encountered"); 1818 return (CodeableConcept) this.value; 1819 } 1820 1821 public boolean hasValueCodeableConcept() { 1822 return this.value instanceof CodeableConcept; 1823 } 1824 1825 /** 1826 * @return {@link #value} (The information determined as a result of making the observation, if the information has a simple value.) 1827 */ 1828 public StringType getValueStringType() throws FHIRException { 1829 if (!(this.value instanceof StringType)) 1830 throw new FHIRException("Type mismatch: the type StringType was expected, but "+this.value.getClass().getName()+" was encountered"); 1831 return (StringType) this.value; 1832 } 1833 1834 public boolean hasValueStringType() { 1835 return this.value instanceof StringType; 1836 } 1837 1838 /** 1839 * @return {@link #value} (The information determined as a result of making the observation, if the information has a simple value.) 1840 */ 1841 public Range getValueRange() throws FHIRException { 1842 if (!(this.value instanceof Range)) 1843 throw new FHIRException("Type mismatch: the type Range was expected, but "+this.value.getClass().getName()+" was encountered"); 1844 return (Range) this.value; 1845 } 1846 1847 public boolean hasValueRange() { 1848 return this.value instanceof Range; 1849 } 1850 1851 /** 1852 * @return {@link #value} (The information determined as a result of making the observation, if the information has a simple value.) 1853 */ 1854 public Ratio getValueRatio() throws FHIRException { 1855 if (!(this.value instanceof Ratio)) 1856 throw new FHIRException("Type mismatch: the type Ratio was expected, but "+this.value.getClass().getName()+" was encountered"); 1857 return (Ratio) this.value; 1858 } 1859 1860 public boolean hasValueRatio() { 1861 return this.value instanceof Ratio; 1862 } 1863 1864 /** 1865 * @return {@link #value} (The information determined as a result of making the observation, if the information has a simple value.) 1866 */ 1867 public SampledData getValueSampledData() throws FHIRException { 1868 if (!(this.value instanceof SampledData)) 1869 throw new FHIRException("Type mismatch: the type SampledData was expected, but "+this.value.getClass().getName()+" was encountered"); 1870 return (SampledData) this.value; 1871 } 1872 1873 public boolean hasValueSampledData() { 1874 return this.value instanceof SampledData; 1875 } 1876 1877 /** 1878 * @return {@link #value} (The information determined as a result of making the observation, if the information has a simple value.) 1879 */ 1880 public Attachment getValueAttachment() throws FHIRException { 1881 if (!(this.value instanceof Attachment)) 1882 throw new FHIRException("Type mismatch: the type Attachment was expected, but "+this.value.getClass().getName()+" was encountered"); 1883 return (Attachment) this.value; 1884 } 1885 1886 public boolean hasValueAttachment() { 1887 return this.value instanceof Attachment; 1888 } 1889 1890 /** 1891 * @return {@link #value} (The information determined as a result of making the observation, if the information has a simple value.) 1892 */ 1893 public TimeType getValueTimeType() throws FHIRException { 1894 if (!(this.value instanceof TimeType)) 1895 throw new FHIRException("Type mismatch: the type TimeType was expected, but "+this.value.getClass().getName()+" was encountered"); 1896 return (TimeType) this.value; 1897 } 1898 1899 public boolean hasValueTimeType() { 1900 return this.value instanceof TimeType; 1901 } 1902 1903 /** 1904 * @return {@link #value} (The information determined as a result of making the observation, if the information has a simple value.) 1905 */ 1906 public DateTimeType getValueDateTimeType() throws FHIRException { 1907 if (!(this.value instanceof DateTimeType)) 1908 throw new FHIRException("Type mismatch: the type DateTimeType was expected, but "+this.value.getClass().getName()+" was encountered"); 1909 return (DateTimeType) this.value; 1910 } 1911 1912 public boolean hasValueDateTimeType() { 1913 return this.value instanceof DateTimeType; 1914 } 1915 1916 /** 1917 * @return {@link #value} (The information determined as a result of making the observation, if the information has a simple value.) 1918 */ 1919 public Period getValuePeriod() throws FHIRException { 1920 if (!(this.value instanceof Period)) 1921 throw new FHIRException("Type mismatch: the type Period was expected, but "+this.value.getClass().getName()+" was encountered"); 1922 return (Period) this.value; 1923 } 1924 1925 public boolean hasValuePeriod() { 1926 return this.value instanceof Period; 1927 } 1928 1929 public boolean hasValue() { 1930 return this.value != null && !this.value.isEmpty(); 1931 } 1932 1933 /** 1934 * @param value {@link #value} (The information determined as a result of making the observation, if the information has a simple value.) 1935 */ 1936 public Observation setValue(Type value) { 1937 this.value = value; 1938 return this; 1939 } 1940 1941 /** 1942 * @return {@link #dataAbsentReason} (Provides a reason why the expected value in the element Observation.value[x] is missing.) 1943 */ 1944 public CodeableConcept getDataAbsentReason() { 1945 if (this.dataAbsentReason == null) 1946 if (Configuration.errorOnAutoCreate()) 1947 throw new Error("Attempt to auto-create Observation.dataAbsentReason"); 1948 else if (Configuration.doAutoCreate()) 1949 this.dataAbsentReason = new CodeableConcept(); // cc 1950 return this.dataAbsentReason; 1951 } 1952 1953 public boolean hasDataAbsentReason() { 1954 return this.dataAbsentReason != null && !this.dataAbsentReason.isEmpty(); 1955 } 1956 1957 /** 1958 * @param value {@link #dataAbsentReason} (Provides a reason why the expected value in the element Observation.value[x] is missing.) 1959 */ 1960 public Observation setDataAbsentReason(CodeableConcept value) { 1961 this.dataAbsentReason = value; 1962 return this; 1963 } 1964 1965 /** 1966 * @return {@link #interpretation} (The assessment made based on the result of the observation. Intended as a simple compact code often placed adjacent to the result value in reports and flow sheets to signal the meaning/normalcy status of the result. Otherwise known as abnormal flag.) 1967 */ 1968 public CodeableConcept getInterpretation() { 1969 if (this.interpretation == null) 1970 if (Configuration.errorOnAutoCreate()) 1971 throw new Error("Attempt to auto-create Observation.interpretation"); 1972 else if (Configuration.doAutoCreate()) 1973 this.interpretation = new CodeableConcept(); // cc 1974 return this.interpretation; 1975 } 1976 1977 public boolean hasInterpretation() { 1978 return this.interpretation != null && !this.interpretation.isEmpty(); 1979 } 1980 1981 /** 1982 * @param value {@link #interpretation} (The assessment made based on the result of the observation. Intended as a simple compact code often placed adjacent to the result value in reports and flow sheets to signal the meaning/normalcy status of the result. Otherwise known as abnormal flag.) 1983 */ 1984 public Observation setInterpretation(CodeableConcept value) { 1985 this.interpretation = value; 1986 return this; 1987 } 1988 1989 /** 1990 * @return {@link #comments} (May include statements about significant, unexpected or unreliable values, or information about the source of the value where this may be relevant to the interpretation of the result.). This is the underlying object with id, value and extensions. The accessor "getComments" gives direct access to the value 1991 */ 1992 public StringType getCommentsElement() { 1993 if (this.comments == null) 1994 if (Configuration.errorOnAutoCreate()) 1995 throw new Error("Attempt to auto-create Observation.comments"); 1996 else if (Configuration.doAutoCreate()) 1997 this.comments = new StringType(); // bb 1998 return this.comments; 1999 } 2000 2001 public boolean hasCommentsElement() { 2002 return this.comments != null && !this.comments.isEmpty(); 2003 } 2004 2005 public boolean hasComments() { 2006 return this.comments != null && !this.comments.isEmpty(); 2007 } 2008 2009 /** 2010 * @param value {@link #comments} (May include statements about significant, unexpected or unreliable values, or information about the source of the value where this may be relevant to the interpretation of the result.). This is the underlying object with id, value and extensions. The accessor "getComments" gives direct access to the value 2011 */ 2012 public Observation setCommentsElement(StringType value) { 2013 this.comments = value; 2014 return this; 2015 } 2016 2017 /** 2018 * @return May include statements about significant, unexpected or unreliable values, or information about the source of the value where this may be relevant to the interpretation of the result. 2019 */ 2020 public String getComments() { 2021 return this.comments == null ? null : this.comments.getValue(); 2022 } 2023 2024 /** 2025 * @param value May include statements about significant, unexpected or unreliable values, or information about the source of the value where this may be relevant to the interpretation of the result. 2026 */ 2027 public Observation setComments(String value) { 2028 if (Utilities.noString(value)) 2029 this.comments = null; 2030 else { 2031 if (this.comments == null) 2032 this.comments = new StringType(); 2033 this.comments.setValue(value); 2034 } 2035 return this; 2036 } 2037 2038 /** 2039 * @return {@link #bodySite} (Indicates the site on the subject's body where the observation was made (i.e. the target site).) 2040 */ 2041 public CodeableConcept getBodySite() { 2042 if (this.bodySite == null) 2043 if (Configuration.errorOnAutoCreate()) 2044 throw new Error("Attempt to auto-create Observation.bodySite"); 2045 else if (Configuration.doAutoCreate()) 2046 this.bodySite = new CodeableConcept(); // cc 2047 return this.bodySite; 2048 } 2049 2050 public boolean hasBodySite() { 2051 return this.bodySite != null && !this.bodySite.isEmpty(); 2052 } 2053 2054 /** 2055 * @param value {@link #bodySite} (Indicates the site on the subject's body where the observation was made (i.e. the target site).) 2056 */ 2057 public Observation setBodySite(CodeableConcept value) { 2058 this.bodySite = value; 2059 return this; 2060 } 2061 2062 /** 2063 * @return {@link #method} (Indicates the mechanism used to perform the observation.) 2064 */ 2065 public CodeableConcept getMethod() { 2066 if (this.method == null) 2067 if (Configuration.errorOnAutoCreate()) 2068 throw new Error("Attempt to auto-create Observation.method"); 2069 else if (Configuration.doAutoCreate()) 2070 this.method = new CodeableConcept(); // cc 2071 return this.method; 2072 } 2073 2074 public boolean hasMethod() { 2075 return this.method != null && !this.method.isEmpty(); 2076 } 2077 2078 /** 2079 * @param value {@link #method} (Indicates the mechanism used to perform the observation.) 2080 */ 2081 public Observation setMethod(CodeableConcept value) { 2082 this.method = value; 2083 return this; 2084 } 2085 2086 /** 2087 * @return {@link #specimen} (The specimen that was used when this observation was made.) 2088 */ 2089 public Reference getSpecimen() { 2090 if (this.specimen == null) 2091 if (Configuration.errorOnAutoCreate()) 2092 throw new Error("Attempt to auto-create Observation.specimen"); 2093 else if (Configuration.doAutoCreate()) 2094 this.specimen = new Reference(); // cc 2095 return this.specimen; 2096 } 2097 2098 public boolean hasSpecimen() { 2099 return this.specimen != null && !this.specimen.isEmpty(); 2100 } 2101 2102 /** 2103 * @param value {@link #specimen} (The specimen that was used when this observation was made.) 2104 */ 2105 public Observation setSpecimen(Reference value) { 2106 this.specimen = value; 2107 return this; 2108 } 2109 2110 /** 2111 * @return {@link #specimen} 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. (The specimen that was used when this observation was made.) 2112 */ 2113 public Specimen getSpecimenTarget() { 2114 if (this.specimenTarget == null) 2115 if (Configuration.errorOnAutoCreate()) 2116 throw new Error("Attempt to auto-create Observation.specimen"); 2117 else if (Configuration.doAutoCreate()) 2118 this.specimenTarget = new Specimen(); // aa 2119 return this.specimenTarget; 2120 } 2121 2122 /** 2123 * @param value {@link #specimen} 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. (The specimen that was used when this observation was made.) 2124 */ 2125 public Observation setSpecimenTarget(Specimen value) { 2126 this.specimenTarget = value; 2127 return this; 2128 } 2129 2130 /** 2131 * @return {@link #device} (The device used to generate the observation data.) 2132 */ 2133 public Reference getDevice() { 2134 if (this.device == null) 2135 if (Configuration.errorOnAutoCreate()) 2136 throw new Error("Attempt to auto-create Observation.device"); 2137 else if (Configuration.doAutoCreate()) 2138 this.device = new Reference(); // cc 2139 return this.device; 2140 } 2141 2142 public boolean hasDevice() { 2143 return this.device != null && !this.device.isEmpty(); 2144 } 2145 2146 /** 2147 * @param value {@link #device} (The device used to generate the observation data.) 2148 */ 2149 public Observation setDevice(Reference value) { 2150 this.device = value; 2151 return this; 2152 } 2153 2154 /** 2155 * @return {@link #device} 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. (The device used to generate the observation data.) 2156 */ 2157 public Resource getDeviceTarget() { 2158 return this.deviceTarget; 2159 } 2160 2161 /** 2162 * @param value {@link #device} 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. (The device used to generate the observation data.) 2163 */ 2164 public Observation setDeviceTarget(Resource value) { 2165 this.deviceTarget = value; 2166 return this; 2167 } 2168 2169 /** 2170 * @return {@link #referenceRange} (Guidance on how to interpret the value by comparison to a normal or recommended range.) 2171 */ 2172 public List<ObservationReferenceRangeComponent> getReferenceRange() { 2173 if (this.referenceRange == null) 2174 this.referenceRange = new ArrayList<ObservationReferenceRangeComponent>(); 2175 return this.referenceRange; 2176 } 2177 2178 public boolean hasReferenceRange() { 2179 if (this.referenceRange == null) 2180 return false; 2181 for (ObservationReferenceRangeComponent item : this.referenceRange) 2182 if (!item.isEmpty()) 2183 return true; 2184 return false; 2185 } 2186 2187 /** 2188 * @return {@link #referenceRange} (Guidance on how to interpret the value by comparison to a normal or recommended range.) 2189 */ 2190 // syntactic sugar 2191 public ObservationReferenceRangeComponent addReferenceRange() { //3 2192 ObservationReferenceRangeComponent t = new ObservationReferenceRangeComponent(); 2193 if (this.referenceRange == null) 2194 this.referenceRange = new ArrayList<ObservationReferenceRangeComponent>(); 2195 this.referenceRange.add(t); 2196 return t; 2197 } 2198 2199 // syntactic sugar 2200 public Observation addReferenceRange(ObservationReferenceRangeComponent t) { //3 2201 if (t == null) 2202 return this; 2203 if (this.referenceRange == null) 2204 this.referenceRange = new ArrayList<ObservationReferenceRangeComponent>(); 2205 this.referenceRange.add(t); 2206 return this; 2207 } 2208 2209 /** 2210 * @return {@link #related} (A reference to another resource (usually another Observation but could also be a QuestionnaireAnswer) whose relationship is defined by the relationship type code.) 2211 */ 2212 public List<ObservationRelatedComponent> getRelated() { 2213 if (this.related == null) 2214 this.related = new ArrayList<ObservationRelatedComponent>(); 2215 return this.related; 2216 } 2217 2218 public boolean hasRelated() { 2219 if (this.related == null) 2220 return false; 2221 for (ObservationRelatedComponent item : this.related) 2222 if (!item.isEmpty()) 2223 return true; 2224 return false; 2225 } 2226 2227 /** 2228 * @return {@link #related} (A reference to another resource (usually another Observation but could also be a QuestionnaireAnswer) whose relationship is defined by the relationship type code.) 2229 */ 2230 // syntactic sugar 2231 public ObservationRelatedComponent addRelated() { //3 2232 ObservationRelatedComponent t = new ObservationRelatedComponent(); 2233 if (this.related == null) 2234 this.related = new ArrayList<ObservationRelatedComponent>(); 2235 this.related.add(t); 2236 return t; 2237 } 2238 2239 // syntactic sugar 2240 public Observation addRelated(ObservationRelatedComponent t) { //3 2241 if (t == null) 2242 return this; 2243 if (this.related == null) 2244 this.related = new ArrayList<ObservationRelatedComponent>(); 2245 this.related.add(t); 2246 return this; 2247 } 2248 2249 /** 2250 * @return {@link #component} (Some observations have multiple component observations. These component observations are expressed as separate code value pairs that share the same attributes. Examples include systolic and diastolic component observations for blood pressure measurement and multiple component observations for genetics observations.) 2251 */ 2252 public List<ObservationComponentComponent> getComponent() { 2253 if (this.component == null) 2254 this.component = new ArrayList<ObservationComponentComponent>(); 2255 return this.component; 2256 } 2257 2258 public boolean hasComponent() { 2259 if (this.component == null) 2260 return false; 2261 for (ObservationComponentComponent item : this.component) 2262 if (!item.isEmpty()) 2263 return true; 2264 return false; 2265 } 2266 2267 /** 2268 * @return {@link #component} (Some observations have multiple component observations. These component observations are expressed as separate code value pairs that share the same attributes. Examples include systolic and diastolic component observations for blood pressure measurement and multiple component observations for genetics observations.) 2269 */ 2270 // syntactic sugar 2271 public ObservationComponentComponent addComponent() { //3 2272 ObservationComponentComponent t = new ObservationComponentComponent(); 2273 if (this.component == null) 2274 this.component = new ArrayList<ObservationComponentComponent>(); 2275 this.component.add(t); 2276 return t; 2277 } 2278 2279 // syntactic sugar 2280 public Observation addComponent(ObservationComponentComponent t) { //3 2281 if (t == null) 2282 return this; 2283 if (this.component == null) 2284 this.component = new ArrayList<ObservationComponentComponent>(); 2285 this.component.add(t); 2286 return this; 2287 } 2288 2289 protected void listChildren(List<Property> childrenList) { 2290 super.listChildren(childrenList); 2291 childrenList.add(new Property("identifier", "Identifier", "A unique identifier for the simple observation instance.", 0, java.lang.Integer.MAX_VALUE, identifier)); 2292 childrenList.add(new Property("status", "code", "The status of the result value.", 0, java.lang.Integer.MAX_VALUE, status)); 2293 childrenList.add(new Property("category", "CodeableConcept", "A code that classifies the general type of observation being made. This is used for searching, sorting and display purposes.", 0, java.lang.Integer.MAX_VALUE, category)); 2294 childrenList.add(new Property("code", "CodeableConcept", "Describes what was observed. Sometimes this is called the observation \"name\".", 0, java.lang.Integer.MAX_VALUE, code)); 2295 childrenList.add(new Property("subject", "Reference(Patient|Group|Device|Location)", "The patient, or group of patients, location, or device whose characteristics (direct or indirect) are described by the observation and into whose record the observation is placed. Comments: Indirect characteristics may be those of a specimen, fetus, donor, other observer (for example a relative or EMT), or any observation made about the subject.", 0, java.lang.Integer.MAX_VALUE, subject)); 2296 childrenList.add(new Property("encounter", "Reference(Encounter)", "The healthcare event (e.g. a patient and healthcare provider interaction) during which this observation is made.", 0, java.lang.Integer.MAX_VALUE, encounter)); 2297 childrenList.add(new Property("effective[x]", "dateTime|Period", "The time or time-period the observed value is asserted as being true. For biological subjects - e.g. human patients - this is usually called the \"physiologically relevant time\". This is usually either the time of the procedure or of specimen collection, but very often the source of the date/time is not known, only the date/time itself.", 0, java.lang.Integer.MAX_VALUE, effective)); 2298 childrenList.add(new Property("issued", "instant", "The date and time this observation was made available to providers, typically after the results have been reviewed and verified.", 0, java.lang.Integer.MAX_VALUE, issued)); 2299 childrenList.add(new Property("performer", "Reference(Practitioner|Organization|Patient|RelatedPerson)", "Who was responsible for asserting the observed value as \"true\".", 0, java.lang.Integer.MAX_VALUE, performer)); 2300 childrenList.add(new Property("value[x]", "Quantity|CodeableConcept|string|Range|Ratio|SampledData|Attachment|time|dateTime|Period", "The information determined as a result of making the observation, if the information has a simple value.", 0, java.lang.Integer.MAX_VALUE, value)); 2301 childrenList.add(new Property("dataAbsentReason", "CodeableConcept", "Provides a reason why the expected value in the element Observation.value[x] is missing.", 0, java.lang.Integer.MAX_VALUE, dataAbsentReason)); 2302 childrenList.add(new Property("interpretation", "CodeableConcept", "The assessment made based on the result of the observation. Intended as a simple compact code often placed adjacent to the result value in reports and flow sheets to signal the meaning/normalcy status of the result. Otherwise known as abnormal flag.", 0, java.lang.Integer.MAX_VALUE, interpretation)); 2303 childrenList.add(new Property("comments", "string", "May include statements about significant, unexpected or unreliable values, or information about the source of the value where this may be relevant to the interpretation of the result.", 0, java.lang.Integer.MAX_VALUE, comments)); 2304 childrenList.add(new Property("bodySite", "CodeableConcept", "Indicates the site on the subject's body where the observation was made (i.e. the target site).", 0, java.lang.Integer.MAX_VALUE, bodySite)); 2305 childrenList.add(new Property("method", "CodeableConcept", "Indicates the mechanism used to perform the observation.", 0, java.lang.Integer.MAX_VALUE, method)); 2306 childrenList.add(new Property("specimen", "Reference(Specimen)", "The specimen that was used when this observation was made.", 0, java.lang.Integer.MAX_VALUE, specimen)); 2307 childrenList.add(new Property("device", "Reference(Device|DeviceMetric)", "The device used to generate the observation data.", 0, java.lang.Integer.MAX_VALUE, device)); 2308 childrenList.add(new Property("referenceRange", "", "Guidance on how to interpret the value by comparison to a normal or recommended range.", 0, java.lang.Integer.MAX_VALUE, referenceRange)); 2309 childrenList.add(new Property("related", "", "A reference to another resource (usually another Observation but could also be a QuestionnaireAnswer) whose relationship is defined by the relationship type code.", 0, java.lang.Integer.MAX_VALUE, related)); 2310 childrenList.add(new Property("component", "", "Some observations have multiple component observations. These component observations are expressed as separate code value pairs that share the same attributes. Examples include systolic and diastolic component observations for blood pressure measurement and multiple component observations for genetics observations.", 0, java.lang.Integer.MAX_VALUE, component)); 2311 } 2312 2313 @Override 2314 public void setProperty(String name, Base value) throws FHIRException { 2315 if (name.equals("identifier")) 2316 this.getIdentifier().add(castToIdentifier(value)); 2317 else if (name.equals("status")) 2318 this.status = new ObservationStatusEnumFactory().fromType(value); // Enumeration<ObservationStatus> 2319 else if (name.equals("category")) 2320 this.category = castToCodeableConcept(value); // CodeableConcept 2321 else if (name.equals("code")) 2322 this.code = castToCodeableConcept(value); // CodeableConcept 2323 else if (name.equals("subject")) 2324 this.subject = castToReference(value); // Reference 2325 else if (name.equals("encounter")) 2326 this.encounter = castToReference(value); // Reference 2327 else if (name.equals("effective[x]")) 2328 this.effective = (Type) value; // Type 2329 else if (name.equals("issued")) 2330 this.issued = castToInstant(value); // InstantType 2331 else if (name.equals("performer")) 2332 this.getPerformer().add(castToReference(value)); 2333 else if (name.equals("value[x]")) 2334 this.value = (Type) value; // Type 2335 else if (name.equals("dataAbsentReason")) 2336 this.dataAbsentReason = castToCodeableConcept(value); // CodeableConcept 2337 else if (name.equals("interpretation")) 2338 this.interpretation = castToCodeableConcept(value); // CodeableConcept 2339 else if (name.equals("comments")) 2340 this.comments = castToString(value); // StringType 2341 else if (name.equals("bodySite")) 2342 this.bodySite = castToCodeableConcept(value); // CodeableConcept 2343 else if (name.equals("method")) 2344 this.method = castToCodeableConcept(value); // CodeableConcept 2345 else if (name.equals("specimen")) 2346 this.specimen = castToReference(value); // Reference 2347 else if (name.equals("device")) 2348 this.device = castToReference(value); // Reference 2349 else if (name.equals("referenceRange")) 2350 this.getReferenceRange().add((ObservationReferenceRangeComponent) value); 2351 else if (name.equals("related")) 2352 this.getRelated().add((ObservationRelatedComponent) value); 2353 else if (name.equals("component")) 2354 this.getComponent().add((ObservationComponentComponent) value); 2355 else 2356 super.setProperty(name, value); 2357 } 2358 2359 @Override 2360 public Base addChild(String name) throws FHIRException { 2361 if (name.equals("identifier")) { 2362 return addIdentifier(); 2363 } 2364 else if (name.equals("status")) { 2365 throw new FHIRException("Cannot call addChild on a primitive type Observation.status"); 2366 } 2367 else if (name.equals("category")) { 2368 this.category = new CodeableConcept(); 2369 return this.category; 2370 } 2371 else if (name.equals("code")) { 2372 this.code = new CodeableConcept(); 2373 return this.code; 2374 } 2375 else if (name.equals("subject")) { 2376 this.subject = new Reference(); 2377 return this.subject; 2378 } 2379 else if (name.equals("encounter")) { 2380 this.encounter = new Reference(); 2381 return this.encounter; 2382 } 2383 else if (name.equals("effectiveDateTime")) { 2384 this.effective = new DateTimeType(); 2385 return this.effective; 2386 } 2387 else if (name.equals("effectivePeriod")) { 2388 this.effective = new Period(); 2389 return this.effective; 2390 } 2391 else if (name.equals("issued")) { 2392 throw new FHIRException("Cannot call addChild on a primitive type Observation.issued"); 2393 } 2394 else if (name.equals("performer")) { 2395 return addPerformer(); 2396 } 2397 else if (name.equals("valueQuantity")) { 2398 this.value = new Quantity(); 2399 return this.value; 2400 } 2401 else if (name.equals("valueCodeableConcept")) { 2402 this.value = new CodeableConcept(); 2403 return this.value; 2404 } 2405 else if (name.equals("valueString")) { 2406 this.value = new StringType(); 2407 return this.value; 2408 } 2409 else if (name.equals("valueRange")) { 2410 this.value = new Range(); 2411 return this.value; 2412 } 2413 else if (name.equals("valueRatio")) { 2414 this.value = new Ratio(); 2415 return this.value; 2416 } 2417 else if (name.equals("valueSampledData")) { 2418 this.value = new SampledData(); 2419 return this.value; 2420 } 2421 else if (name.equals("valueAttachment")) { 2422 this.value = new Attachment(); 2423 return this.value; 2424 } 2425 else if (name.equals("valueTime")) { 2426 this.value = new TimeType(); 2427 return this.value; 2428 } 2429 else if (name.equals("valueDateTime")) { 2430 this.value = new DateTimeType(); 2431 return this.value; 2432 } 2433 else if (name.equals("valuePeriod")) { 2434 this.value = new Period(); 2435 return this.value; 2436 } 2437 else if (name.equals("dataAbsentReason")) { 2438 this.dataAbsentReason = new CodeableConcept(); 2439 return this.dataAbsentReason; 2440 } 2441 else if (name.equals("interpretation")) { 2442 this.interpretation = new CodeableConcept(); 2443 return this.interpretation; 2444 } 2445 else if (name.equals("comments")) { 2446 throw new FHIRException("Cannot call addChild on a primitive type Observation.comments"); 2447 } 2448 else if (name.equals("bodySite")) { 2449 this.bodySite = new CodeableConcept(); 2450 return this.bodySite; 2451 } 2452 else if (name.equals("method")) { 2453 this.method = new CodeableConcept(); 2454 return this.method; 2455 } 2456 else if (name.equals("specimen")) { 2457 this.specimen = new Reference(); 2458 return this.specimen; 2459 } 2460 else if (name.equals("device")) { 2461 this.device = new Reference(); 2462 return this.device; 2463 } 2464 else if (name.equals("referenceRange")) { 2465 return addReferenceRange(); 2466 } 2467 else if (name.equals("related")) { 2468 return addRelated(); 2469 } 2470 else if (name.equals("component")) { 2471 return addComponent(); 2472 } 2473 else 2474 return super.addChild(name); 2475 } 2476 2477 public String fhirType() { 2478 return "Observation"; 2479 2480 } 2481 2482 public Observation copy() { 2483 Observation dst = new Observation(); 2484 copyValues(dst); 2485 if (identifier != null) { 2486 dst.identifier = new ArrayList<Identifier>(); 2487 for (Identifier i : identifier) 2488 dst.identifier.add(i.copy()); 2489 }; 2490 dst.status = status == null ? null : status.copy(); 2491 dst.category = category == null ? null : category.copy(); 2492 dst.code = code == null ? null : code.copy(); 2493 dst.subject = subject == null ? null : subject.copy(); 2494 dst.encounter = encounter == null ? null : encounter.copy(); 2495 dst.effective = effective == null ? null : effective.copy(); 2496 dst.issued = issued == null ? null : issued.copy(); 2497 if (performer != null) { 2498 dst.performer = new ArrayList<Reference>(); 2499 for (Reference i : performer) 2500 dst.performer.add(i.copy()); 2501 }; 2502 dst.value = value == null ? null : value.copy(); 2503 dst.dataAbsentReason = dataAbsentReason == null ? null : dataAbsentReason.copy(); 2504 dst.interpretation = interpretation == null ? null : interpretation.copy(); 2505 dst.comments = comments == null ? null : comments.copy(); 2506 dst.bodySite = bodySite == null ? null : bodySite.copy(); 2507 dst.method = method == null ? null : method.copy(); 2508 dst.specimen = specimen == null ? null : specimen.copy(); 2509 dst.device = device == null ? null : device.copy(); 2510 if (referenceRange != null) { 2511 dst.referenceRange = new ArrayList<ObservationReferenceRangeComponent>(); 2512 for (ObservationReferenceRangeComponent i : referenceRange) 2513 dst.referenceRange.add(i.copy()); 2514 }; 2515 if (related != null) { 2516 dst.related = new ArrayList<ObservationRelatedComponent>(); 2517 for (ObservationRelatedComponent i : related) 2518 dst.related.add(i.copy()); 2519 }; 2520 if (component != null) { 2521 dst.component = new ArrayList<ObservationComponentComponent>(); 2522 for (ObservationComponentComponent i : component) 2523 dst.component.add(i.copy()); 2524 }; 2525 return dst; 2526 } 2527 2528 protected Observation typedCopy() { 2529 return copy(); 2530 } 2531 2532 @Override 2533 public boolean equalsDeep(Base other) { 2534 if (!super.equalsDeep(other)) 2535 return false; 2536 if (!(other instanceof Observation)) 2537 return false; 2538 Observation o = (Observation) other; 2539 return compareDeep(identifier, o.identifier, true) && compareDeep(status, o.status, true) && compareDeep(category, o.category, true) 2540 && compareDeep(code, o.code, true) && compareDeep(subject, o.subject, true) && compareDeep(encounter, o.encounter, true) 2541 && compareDeep(effective, o.effective, true) && compareDeep(issued, o.issued, true) && compareDeep(performer, o.performer, true) 2542 && compareDeep(value, o.value, true) && compareDeep(dataAbsentReason, o.dataAbsentReason, true) 2543 && compareDeep(interpretation, o.interpretation, true) && compareDeep(comments, o.comments, true) 2544 && compareDeep(bodySite, o.bodySite, true) && compareDeep(method, o.method, true) && compareDeep(specimen, o.specimen, true) 2545 && compareDeep(device, o.device, true) && compareDeep(referenceRange, o.referenceRange, true) && compareDeep(related, o.related, true) 2546 && compareDeep(component, o.component, true); 2547 } 2548 2549 @Override 2550 public boolean equalsShallow(Base other) { 2551 if (!super.equalsShallow(other)) 2552 return false; 2553 if (!(other instanceof Observation)) 2554 return false; 2555 Observation o = (Observation) other; 2556 return compareValues(status, o.status, true) && compareValues(issued, o.issued, true) && compareValues(comments, o.comments, true) 2557 ; 2558 } 2559 2560 public boolean isEmpty() { 2561 return super.isEmpty() && (identifier == null || identifier.isEmpty()) && (status == null || status.isEmpty()) 2562 && (category == null || category.isEmpty()) && (code == null || code.isEmpty()) && (subject == null || subject.isEmpty()) 2563 && (encounter == null || encounter.isEmpty()) && (effective == null || effective.isEmpty()) 2564 && (issued == null || issued.isEmpty()) && (performer == null || performer.isEmpty()) && (value == null || value.isEmpty()) 2565 && (dataAbsentReason == null || dataAbsentReason.isEmpty()) && (interpretation == null || interpretation.isEmpty()) 2566 && (comments == null || comments.isEmpty()) && (bodySite == null || bodySite.isEmpty()) && (method == null || method.isEmpty()) 2567 && (specimen == null || specimen.isEmpty()) && (device == null || device.isEmpty()) && (referenceRange == null || referenceRange.isEmpty()) 2568 && (related == null || related.isEmpty()) && (component == null || component.isEmpty()); 2569 } 2570 2571 @Override 2572 public ResourceType getResourceType() { 2573 return ResourceType.Observation; 2574 } 2575 2576 @SearchParamDefinition(name="date", path="Observation.effective[x]", description="Obtained date/time. If the obtained element is a period, a date that falls in the period", type="date" ) 2577 public static final String SP_DATE = "date"; 2578 @SearchParamDefinition(name="code", path="Observation.code", description="The code of the observation type", type="token" ) 2579 public static final String SP_CODE = "code"; 2580 @SearchParamDefinition(name="subject", path="Observation.subject", description="The subject that the observation is about", type="reference" ) 2581 public static final String SP_SUBJECT = "subject"; 2582 @SearchParamDefinition(name="component-data-absent-reason", path="Observation.component.dataAbsentReason", description="The reason why the expected value in the element Observation.component.value[x] is missing.", type="token" ) 2583 public static final String SP_COMPONENTDATAABSENTREASON = "component-data-absent-reason"; 2584 @SearchParamDefinition(name="value-concept", path="Observation.valueCodeableConcept", description="The value of the observation, if the value is a CodeableConcept", type="token" ) 2585 public static final String SP_VALUECONCEPT = "value-concept"; 2586 @SearchParamDefinition(name="value-date", path="Observation.valueDateTime | Observation.valuePeriod", description="The value of the observation, if the value is a date or period of time", type="date" ) 2587 public static final String SP_VALUEDATE = "value-date"; 2588 @SearchParamDefinition(name="related", path="null", description="Related Observations - search on related-type and related-target together", type="composite" ) 2589 public static final String SP_RELATED = "related"; 2590 @SearchParamDefinition(name="patient", path="Observation.subject", description="The subject that the observation is about (if patient)", type="reference" ) 2591 public static final String SP_PATIENT = "patient"; 2592 @SearchParamDefinition(name="specimen", path="Observation.specimen", description="Specimen used for this observation", type="reference" ) 2593 public static final String SP_SPECIMEN = "specimen"; 2594 @SearchParamDefinition(name="component-code", path="Observation.component.code", description="The component code of the observation type", type="token" ) 2595 public static final String SP_COMPONENTCODE = "component-code"; 2596 @SearchParamDefinition(name="value-string", path="Observation.valueString", description="The value of the observation, if the value is a string, and also searches in CodeableConcept.text", type="string" ) 2597 public static final String SP_VALUESTRING = "value-string"; 2598 @SearchParamDefinition(name="identifier", path="Observation.identifier", description="The unique id for a particular observation", type="token" ) 2599 public static final String SP_IDENTIFIER = "identifier"; 2600 @SearchParamDefinition(name="component-code-value-[x]", path="null", description="Both component code and one of the component value parameters", type="composite" ) 2601 public static final String SP_COMPONENTCODEVALUEX = "component-code-value-[x]"; 2602 @SearchParamDefinition(name="code-value-[x]", path="null", description="Both code and one of the value parameters", type="composite" ) 2603 public static final String SP_CODEVALUEX = "code-value-[x]"; 2604 @SearchParamDefinition(name="performer", path="Observation.performer", description="Who performed the observation", type="reference" ) 2605 public static final String SP_PERFORMER = "performer"; 2606 @SearchParamDefinition(name="value-quantity", path="Observation.valueQuantity", description="The value of the observation, if the value is a Quantity, or a SampledData (just search on the bounds of the values in sampled data)", type="quantity" ) 2607 public static final String SP_VALUEQUANTITY = "value-quantity"; 2608 @SearchParamDefinition(name="component-value-quantity", path="Observation.component.valueQuantity", description="The value of the component observation, if the value is a Quantity, or a SampledData (just search on the bounds of the values in sampled data)", type="quantity" ) 2609 public static final String SP_COMPONENTVALUEQUANTITY = "component-value-quantity"; 2610 @SearchParamDefinition(name="data-absent-reason", path="Observation.dataAbsentReason", description="The reason why the expected value in the element Observation.value[x] is missing.", type="token" ) 2611 public static final String SP_DATAABSENTREASON = "data-absent-reason"; 2612 @SearchParamDefinition(name="encounter", path="Observation.encounter", description="Healthcare event related to the observation", type="reference" ) 2613 public static final String SP_ENCOUNTER = "encounter"; 2614 @SearchParamDefinition(name="related-type", path="Observation.related.type", description="has-member | derived-from | sequel-to | replaces | qualified-by | interfered-by", type="token" ) 2615 public static final String SP_RELATEDTYPE = "related-type"; 2616 @SearchParamDefinition(name="related-target", path="Observation.related.target", description="Resource that is related to this one", type="reference" ) 2617 public static final String SP_RELATEDTARGET = "related-target"; 2618 @SearchParamDefinition(name="component-value-string", path="Observation.component.valueString", description="The value of the component observation, if the value is a string, and also searches in CodeableConcept.text", type="string" ) 2619 public static final String SP_COMPONENTVALUESTRING = "component-value-string"; 2620 @SearchParamDefinition(name="component-value-concept", path="Observation.component.valueCodeableConcept", description="The value of the component observation, if the value is a CodeableConcept", type="token" ) 2621 public static final String SP_COMPONENTVALUECONCEPT = "component-value-concept"; 2622 @SearchParamDefinition(name="category", path="Observation.category", description="The classification of the type of observation", type="token" ) 2623 public static final String SP_CATEGORY = "category"; 2624 @SearchParamDefinition(name="device", path="Observation.device", description="The Device that generated the observation data.", type="reference" ) 2625 public static final String SP_DEVICE = "device"; 2626 @SearchParamDefinition(name="status", path="Observation.status", description="The status of the observation", type="token" ) 2627 public static final String SP_STATUS = "status"; 2628 2629} 2630