001package org.hl7.fhir.dstu2016may.model;
002
003
004
005
006/*
007  Copyright (c) 2011+, HL7, Inc.
008  All rights reserved.
009  
010  Redistribution and use in source and binary forms, with or without modification, 
011  are permitted provided that the following conditions are met:
012  
013   * Redistributions of source code must retain the above copyright notice, this 
014     list of conditions and the following disclaimer.
015   * Redistributions in binary form must reproduce the above copyright notice, 
016     this list of conditions and the following disclaimer in the documentation 
017     and/or other materials provided with the distribution.
018   * Neither the name of HL7 nor the names of its contributors may be used to 
019     endorse or promote products derived from this software without specific 
020     prior written permission.
021  
022  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
023  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
024  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
025  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
026  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
027  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
028  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
029  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
030  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
031  POSSIBILITY OF SUCH DAMAGE.
032  
033*/
034
035// Generated on Sun, May 8, 2016 03:05+1000 for FHIR v1.4.0
036import java.util.ArrayList;
037import java.util.Date;
038import java.util.List;
039
040import org.hl7.fhir.exceptions.FHIRException;
041import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
042import org.hl7.fhir.utilities.Utilities;
043
044import ca.uhn.fhir.model.api.annotation.Block;
045import ca.uhn.fhir.model.api.annotation.Child;
046import ca.uhn.fhir.model.api.annotation.Description;
047import ca.uhn.fhir.model.api.annotation.ResourceDef;
048import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
049/**
050 * Measurements and simple assertions made about a patient, device or other subject.
051 */
052@ResourceDef(name="Observation", profile="http://hl7.org/fhir/Profile/Observation")
053public class Observation extends DomainResource {
054
055    public enum ObservationStatus {
056        /**
057         * The existence of the observation is registered, but there is no result yet available.
058         */
059        REGISTERED, 
060        /**
061         * This is an initial or interim observation: data may be incomplete or unverified.
062         */
063        PRELIMINARY, 
064        /**
065         * The observation is complete and verified by an authorized person  (who may be the same person who entered the observation based on policy).
066         */
067        FINAL, 
068        /**
069         * The observation has been modified subsequent to being Final, and is complete and verified by an authorized person.
070         */
071        AMENDED, 
072        /**
073         * The observation is unavailable because the measurement was not started or not completed (also sometimes called "aborted").
074         */
075        CANCELLED, 
076        /**
077         * The observation has been withdrawn following previous final release.
078         */
079        ENTEREDINERROR, 
080        /**
081         * 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".
082         */
083        UNKNOWN, 
084        /**
085         * added to help the parsers
086         */
087        NULL;
088        public static ObservationStatus fromCode(String codeString) throws FHIRException {
089            if (codeString == null || "".equals(codeString))
090                return null;
091        if ("registered".equals(codeString))
092          return REGISTERED;
093        if ("preliminary".equals(codeString))
094          return PRELIMINARY;
095        if ("final".equals(codeString))
096          return FINAL;
097        if ("amended".equals(codeString))
098          return AMENDED;
099        if ("cancelled".equals(codeString))
100          return CANCELLED;
101        if ("entered-in-error".equals(codeString))
102          return ENTEREDINERROR;
103        if ("unknown".equals(codeString))
104          return UNKNOWN;
105        throw new FHIRException("Unknown ObservationStatus code '"+codeString+"'");
106        }
107        public String toCode() {
108          switch (this) {
109            case REGISTERED: return "registered";
110            case PRELIMINARY: return "preliminary";
111            case FINAL: return "final";
112            case AMENDED: return "amended";
113            case CANCELLED: return "cancelled";
114            case ENTEREDINERROR: return "entered-in-error";
115            case UNKNOWN: return "unknown";
116            case NULL: return null;
117            default: return "?";
118          }
119        }
120        public String getSystem() {
121          switch (this) {
122            case REGISTERED: return "http://hl7.org/fhir/observation-status";
123            case PRELIMINARY: return "http://hl7.org/fhir/observation-status";
124            case FINAL: return "http://hl7.org/fhir/observation-status";
125            case AMENDED: return "http://hl7.org/fhir/observation-status";
126            case CANCELLED: return "http://hl7.org/fhir/observation-status";
127            case ENTEREDINERROR: return "http://hl7.org/fhir/observation-status";
128            case UNKNOWN: return "http://hl7.org/fhir/observation-status";
129            case NULL: return null;
130            default: return "?";
131          }
132        }
133        public String getDefinition() {
134          switch (this) {
135            case REGISTERED: return "The existence of the observation is registered, but there is no result yet available.";
136            case PRELIMINARY: return "This is an initial or interim observation: data may be incomplete or unverified.";
137            case FINAL: return "The observation is complete and verified by an authorized person  (who may be the same person who entered the observation based on policy).";
138            case AMENDED: return "The observation has been modified subsequent to being Final, and is complete and verified by an authorized person.";
139            case CANCELLED: return "The observation is unavailable because the measurement was not started or not completed (also sometimes called \"aborted\").";
140            case ENTEREDINERROR: return "The observation has been withdrawn following previous final release.";
141            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\".";
142            case NULL: return null;
143            default: return "?";
144          }
145        }
146        public String getDisplay() {
147          switch (this) {
148            case REGISTERED: return "Registered";
149            case PRELIMINARY: return "Preliminary";
150            case FINAL: return "Final";
151            case AMENDED: return "Amended";
152            case CANCELLED: return "cancelled";
153            case ENTEREDINERROR: return "Entered in Error";
154            case UNKNOWN: return "Unknown Status";
155            case NULL: return null;
156            default: return "?";
157          }
158        }
159    }
160
161  public static class ObservationStatusEnumFactory implements EnumFactory<ObservationStatus> {
162    public ObservationStatus fromCode(String codeString) throws IllegalArgumentException {
163      if (codeString == null || "".equals(codeString))
164            if (codeString == null || "".equals(codeString))
165                return null;
166        if ("registered".equals(codeString))
167          return ObservationStatus.REGISTERED;
168        if ("preliminary".equals(codeString))
169          return ObservationStatus.PRELIMINARY;
170        if ("final".equals(codeString))
171          return ObservationStatus.FINAL;
172        if ("amended".equals(codeString))
173          return ObservationStatus.AMENDED;
174        if ("cancelled".equals(codeString))
175          return ObservationStatus.CANCELLED;
176        if ("entered-in-error".equals(codeString))
177          return ObservationStatus.ENTEREDINERROR;
178        if ("unknown".equals(codeString))
179          return ObservationStatus.UNKNOWN;
180        throw new IllegalArgumentException("Unknown ObservationStatus code '"+codeString+"'");
181        }
182        public Enumeration<ObservationStatus> fromType(Base code) throws FHIRException {
183          if (code == null || code.isEmpty())
184            return null;
185          String codeString = ((PrimitiveType) code).asStringValue();
186          if (codeString == null || "".equals(codeString))
187            return null;
188        if ("registered".equals(codeString))
189          return new Enumeration<ObservationStatus>(this, ObservationStatus.REGISTERED);
190        if ("preliminary".equals(codeString))
191          return new Enumeration<ObservationStatus>(this, ObservationStatus.PRELIMINARY);
192        if ("final".equals(codeString))
193          return new Enumeration<ObservationStatus>(this, ObservationStatus.FINAL);
194        if ("amended".equals(codeString))
195          return new Enumeration<ObservationStatus>(this, ObservationStatus.AMENDED);
196        if ("cancelled".equals(codeString))
197          return new Enumeration<ObservationStatus>(this, ObservationStatus.CANCELLED);
198        if ("entered-in-error".equals(codeString))
199          return new Enumeration<ObservationStatus>(this, ObservationStatus.ENTEREDINERROR);
200        if ("unknown".equals(codeString))
201          return new Enumeration<ObservationStatus>(this, ObservationStatus.UNKNOWN);
202        throw new FHIRException("Unknown ObservationStatus code '"+codeString+"'");
203        }
204    public String toCode(ObservationStatus code) {
205      if (code == ObservationStatus.REGISTERED)
206        return "registered";
207      if (code == ObservationStatus.PRELIMINARY)
208        return "preliminary";
209      if (code == ObservationStatus.FINAL)
210        return "final";
211      if (code == ObservationStatus.AMENDED)
212        return "amended";
213      if (code == ObservationStatus.CANCELLED)
214        return "cancelled";
215      if (code == ObservationStatus.ENTEREDINERROR)
216        return "entered-in-error";
217      if (code == ObservationStatus.UNKNOWN)
218        return "unknown";
219      return "?";
220      }
221    public String toSystem(ObservationStatus code) {
222      return code.getSystem();
223      }
224    }
225
226    public enum ObservationRelationshipType {
227        /**
228         * 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.
229         */
230        HASMEMBER, 
231        /**
232         * 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.
233         */
234        DERIVEDFROM, 
235        /**
236         * This observation follows the target observation (e.g. timed tests such as Glucose Tolerance Test).
237         */
238        SEQUELTO, 
239        /**
240         * This observation replaces a previous observation (i.e. a revised value). The target observation is now obsolete.
241         */
242        REPLACES, 
243        /**
244         * The value of the target observation qualifies (refines) the semantics of the source observation (e.g. a lipemia measure target from a plasma measure).
245         */
246        QUALIFIEDBY, 
247        /**
248         * 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).
249         */
250        INTERFEREDBY, 
251        /**
252         * added to help the parsers
253         */
254        NULL;
255        public static ObservationRelationshipType fromCode(String codeString) throws FHIRException {
256            if (codeString == null || "".equals(codeString))
257                return null;
258        if ("has-member".equals(codeString))
259          return HASMEMBER;
260        if ("derived-from".equals(codeString))
261          return DERIVEDFROM;
262        if ("sequel-to".equals(codeString))
263          return SEQUELTO;
264        if ("replaces".equals(codeString))
265          return REPLACES;
266        if ("qualified-by".equals(codeString))
267          return QUALIFIEDBY;
268        if ("interfered-by".equals(codeString))
269          return INTERFEREDBY;
270        throw new FHIRException("Unknown ObservationRelationshipType code '"+codeString+"'");
271        }
272        public String toCode() {
273          switch (this) {
274            case HASMEMBER: return "has-member";
275            case DERIVEDFROM: return "derived-from";
276            case SEQUELTO: return "sequel-to";
277            case REPLACES: return "replaces";
278            case QUALIFIEDBY: return "qualified-by";
279            case INTERFEREDBY: return "interfered-by";
280            case NULL: return null;
281            default: return "?";
282          }
283        }
284        public String getSystem() {
285          switch (this) {
286            case HASMEMBER: return "http://hl7.org/fhir/observation-relationshiptypes";
287            case DERIVEDFROM: return "http://hl7.org/fhir/observation-relationshiptypes";
288            case SEQUELTO: return "http://hl7.org/fhir/observation-relationshiptypes";
289            case REPLACES: return "http://hl7.org/fhir/observation-relationshiptypes";
290            case QUALIFIEDBY: return "http://hl7.org/fhir/observation-relationshiptypes";
291            case INTERFEREDBY: return "http://hl7.org/fhir/observation-relationshiptypes";
292            case NULL: return null;
293            default: return "?";
294          }
295        }
296        public String getDefinition() {
297          switch (this) {
298            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.";
299            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.";
300            case SEQUELTO: return "This observation follows the target observation (e.g. timed tests such as Glucose Tolerance Test).";
301            case REPLACES: return "This observation replaces a previous observation (i.e. a revised value). The target observation is now obsolete.";
302            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).";
303            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).";
304            case NULL: return null;
305            default: return "?";
306          }
307        }
308        public String getDisplay() {
309          switch (this) {
310            case HASMEMBER: return "Has Member";
311            case DERIVEDFROM: return "Derived From";
312            case SEQUELTO: return "Sequel To";
313            case REPLACES: return "Replaces";
314            case QUALIFIEDBY: return "Qualified By";
315            case INTERFEREDBY: return "Interfered By";
316            case NULL: return null;
317            default: return "?";
318          }
319        }
320    }
321
322  public static class ObservationRelationshipTypeEnumFactory implements EnumFactory<ObservationRelationshipType> {
323    public ObservationRelationshipType fromCode(String codeString) throws IllegalArgumentException {
324      if (codeString == null || "".equals(codeString))
325            if (codeString == null || "".equals(codeString))
326                return null;
327        if ("has-member".equals(codeString))
328          return ObservationRelationshipType.HASMEMBER;
329        if ("derived-from".equals(codeString))
330          return ObservationRelationshipType.DERIVEDFROM;
331        if ("sequel-to".equals(codeString))
332          return ObservationRelationshipType.SEQUELTO;
333        if ("replaces".equals(codeString))
334          return ObservationRelationshipType.REPLACES;
335        if ("qualified-by".equals(codeString))
336          return ObservationRelationshipType.QUALIFIEDBY;
337        if ("interfered-by".equals(codeString))
338          return ObservationRelationshipType.INTERFEREDBY;
339        throw new IllegalArgumentException("Unknown ObservationRelationshipType code '"+codeString+"'");
340        }
341        public Enumeration<ObservationRelationshipType> fromType(Base code) throws FHIRException {
342          if (code == null || code.isEmpty())
343            return null;
344          String codeString = ((PrimitiveType) code).asStringValue();
345          if (codeString == null || "".equals(codeString))
346            return null;
347        if ("has-member".equals(codeString))
348          return new Enumeration<ObservationRelationshipType>(this, ObservationRelationshipType.HASMEMBER);
349        if ("derived-from".equals(codeString))
350          return new Enumeration<ObservationRelationshipType>(this, ObservationRelationshipType.DERIVEDFROM);
351        if ("sequel-to".equals(codeString))
352          return new Enumeration<ObservationRelationshipType>(this, ObservationRelationshipType.SEQUELTO);
353        if ("replaces".equals(codeString))
354          return new Enumeration<ObservationRelationshipType>(this, ObservationRelationshipType.REPLACES);
355        if ("qualified-by".equals(codeString))
356          return new Enumeration<ObservationRelationshipType>(this, ObservationRelationshipType.QUALIFIEDBY);
357        if ("interfered-by".equals(codeString))
358          return new Enumeration<ObservationRelationshipType>(this, ObservationRelationshipType.INTERFEREDBY);
359        throw new FHIRException("Unknown ObservationRelationshipType code '"+codeString+"'");
360        }
361    public String toCode(ObservationRelationshipType code) {
362      if (code == ObservationRelationshipType.HASMEMBER)
363        return "has-member";
364      if (code == ObservationRelationshipType.DERIVEDFROM)
365        return "derived-from";
366      if (code == ObservationRelationshipType.SEQUELTO)
367        return "sequel-to";
368      if (code == ObservationRelationshipType.REPLACES)
369        return "replaces";
370      if (code == ObservationRelationshipType.QUALIFIEDBY)
371        return "qualified-by";
372      if (code == ObservationRelationshipType.INTERFEREDBY)
373        return "interfered-by";
374      return "?";
375      }
376    public String toSystem(ObservationRelationshipType code) {
377      return code.getSystem();
378      }
379    }
380
381    @Block()
382    public static class ObservationReferenceRangeComponent extends BackboneElement implements IBaseBackboneElement {
383        /**
384         * 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).
385         */
386        @Child(name = "low", type = {SimpleQuantity.class}, order=1, min=0, max=1, modifier=false, summary=false)
387        @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)." )
388        protected SimpleQuantity low;
389
390        /**
391         * 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).
392         */
393        @Child(name = "high", type = {SimpleQuantity.class}, order=2, min=0, max=1, modifier=false, summary=false)
394        @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)." )
395        protected SimpleQuantity high;
396
397        /**
398         * Code for the meaning of the reference range.
399         */
400        @Child(name = "meaning", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=false)
401        @Description(shortDefinition="Indicates the meaning/use of this range of this range", formalDefinition="Code for the meaning of the reference range." )
402        protected CodeableConcept meaning;
403
404        /**
405         * 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.
406         */
407        @Child(name = "age", type = {Range.class}, order=4, min=0, max=1, modifier=false, summary=false)
408        @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." )
409        protected Range age;
410
411        /**
412         * 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'.
413         */
414        @Child(name = "text", type = {StringType.class}, order=5, min=0, max=1, modifier=false, summary=false)
415        @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'." )
416        protected StringType text;
417
418        private static final long serialVersionUID = -238694788L;
419
420    /**
421     * Constructor
422     */
423      public ObservationReferenceRangeComponent() {
424        super();
425      }
426
427        /**
428         * @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).)
429         */
430        public SimpleQuantity getLow() { 
431          if (this.low == null)
432            if (Configuration.errorOnAutoCreate())
433              throw new Error("Attempt to auto-create ObservationReferenceRangeComponent.low");
434            else if (Configuration.doAutoCreate())
435              this.low = new SimpleQuantity(); // cc
436          return this.low;
437        }
438
439        public boolean hasLow() { 
440          return this.low != null && !this.low.isEmpty();
441        }
442
443        /**
444         * @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).)
445         */
446        public ObservationReferenceRangeComponent setLow(SimpleQuantity value) { 
447          this.low = value;
448          return this;
449        }
450
451        /**
452         * @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).)
453         */
454        public SimpleQuantity getHigh() { 
455          if (this.high == null)
456            if (Configuration.errorOnAutoCreate())
457              throw new Error("Attempt to auto-create ObservationReferenceRangeComponent.high");
458            else if (Configuration.doAutoCreate())
459              this.high = new SimpleQuantity(); // cc
460          return this.high;
461        }
462
463        public boolean hasHigh() { 
464          return this.high != null && !this.high.isEmpty();
465        }
466
467        /**
468         * @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).)
469         */
470        public ObservationReferenceRangeComponent setHigh(SimpleQuantity value) { 
471          this.high = value;
472          return this;
473        }
474
475        /**
476         * @return {@link #meaning} (Code for the meaning of the reference range.)
477         */
478        public CodeableConcept getMeaning() { 
479          if (this.meaning == null)
480            if (Configuration.errorOnAutoCreate())
481              throw new Error("Attempt to auto-create ObservationReferenceRangeComponent.meaning");
482            else if (Configuration.doAutoCreate())
483              this.meaning = new CodeableConcept(); // cc
484          return this.meaning;
485        }
486
487        public boolean hasMeaning() { 
488          return this.meaning != null && !this.meaning.isEmpty();
489        }
490
491        /**
492         * @param value {@link #meaning} (Code for the meaning of the reference range.)
493         */
494        public ObservationReferenceRangeComponent setMeaning(CodeableConcept value) { 
495          this.meaning = value;
496          return this;
497        }
498
499        /**
500         * @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.)
501         */
502        public Range getAge() { 
503          if (this.age == null)
504            if (Configuration.errorOnAutoCreate())
505              throw new Error("Attempt to auto-create ObservationReferenceRangeComponent.age");
506            else if (Configuration.doAutoCreate())
507              this.age = new Range(); // cc
508          return this.age;
509        }
510
511        public boolean hasAge() { 
512          return this.age != null && !this.age.isEmpty();
513        }
514
515        /**
516         * @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.)
517         */
518        public ObservationReferenceRangeComponent setAge(Range value) { 
519          this.age = value;
520          return this;
521        }
522
523        /**
524         * @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
525         */
526        public StringType getTextElement() { 
527          if (this.text == null)
528            if (Configuration.errorOnAutoCreate())
529              throw new Error("Attempt to auto-create ObservationReferenceRangeComponent.text");
530            else if (Configuration.doAutoCreate())
531              this.text = new StringType(); // bb
532          return this.text;
533        }
534
535        public boolean hasTextElement() { 
536          return this.text != null && !this.text.isEmpty();
537        }
538
539        public boolean hasText() { 
540          return this.text != null && !this.text.isEmpty();
541        }
542
543        /**
544         * @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
545         */
546        public ObservationReferenceRangeComponent setTextElement(StringType value) { 
547          this.text = value;
548          return this;
549        }
550
551        /**
552         * @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'.
553         */
554        public String getText() { 
555          return this.text == null ? null : this.text.getValue();
556        }
557
558        /**
559         * @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'.
560         */
561        public ObservationReferenceRangeComponent setText(String value) { 
562          if (Utilities.noString(value))
563            this.text = null;
564          else {
565            if (this.text == null)
566              this.text = new StringType();
567            this.text.setValue(value);
568          }
569          return this;
570        }
571
572        protected void listChildren(List<Property> childrenList) {
573          super.listChildren(childrenList);
574          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));
575          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));
576          childrenList.add(new Property("meaning", "CodeableConcept", "Code for the meaning of the reference range.", 0, java.lang.Integer.MAX_VALUE, meaning));
577          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));
578          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));
579        }
580
581      @Override
582      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
583        switch (hash) {
584        case 107348: /*low*/ return this.low == null ? new Base[0] : new Base[] {this.low}; // SimpleQuantity
585        case 3202466: /*high*/ return this.high == null ? new Base[0] : new Base[] {this.high}; // SimpleQuantity
586        case 938160637: /*meaning*/ return this.meaning == null ? new Base[0] : new Base[] {this.meaning}; // CodeableConcept
587        case 96511: /*age*/ return this.age == null ? new Base[0] : new Base[] {this.age}; // Range
588        case 3556653: /*text*/ return this.text == null ? new Base[0] : new Base[] {this.text}; // StringType
589        default: return super.getProperty(hash, name, checkValid);
590        }
591
592      }
593
594      @Override
595      public void setProperty(int hash, String name, Base value) throws FHIRException {
596        switch (hash) {
597        case 107348: // low
598          this.low = castToSimpleQuantity(value); // SimpleQuantity
599          break;
600        case 3202466: // high
601          this.high = castToSimpleQuantity(value); // SimpleQuantity
602          break;
603        case 938160637: // meaning
604          this.meaning = castToCodeableConcept(value); // CodeableConcept
605          break;
606        case 96511: // age
607          this.age = castToRange(value); // Range
608          break;
609        case 3556653: // text
610          this.text = castToString(value); // StringType
611          break;
612        default: super.setProperty(hash, name, value);
613        }
614
615      }
616
617      @Override
618      public void setProperty(String name, Base value) throws FHIRException {
619        if (name.equals("low"))
620          this.low = castToSimpleQuantity(value); // SimpleQuantity
621        else if (name.equals("high"))
622          this.high = castToSimpleQuantity(value); // SimpleQuantity
623        else if (name.equals("meaning"))
624          this.meaning = castToCodeableConcept(value); // CodeableConcept
625        else if (name.equals("age"))
626          this.age = castToRange(value); // Range
627        else if (name.equals("text"))
628          this.text = castToString(value); // StringType
629        else
630          super.setProperty(name, value);
631      }
632
633      @Override
634      public Base makeProperty(int hash, String name) throws FHIRException {
635        switch (hash) {
636        case 107348:  return getLow(); // SimpleQuantity
637        case 3202466:  return getHigh(); // SimpleQuantity
638        case 938160637:  return getMeaning(); // CodeableConcept
639        case 96511:  return getAge(); // Range
640        case 3556653: throw new FHIRException("Cannot make property text as it is not a complex type"); // StringType
641        default: return super.makeProperty(hash, name);
642        }
643
644      }
645
646      @Override
647      public Base addChild(String name) throws FHIRException {
648        if (name.equals("low")) {
649          this.low = new SimpleQuantity();
650          return this.low;
651        }
652        else if (name.equals("high")) {
653          this.high = new SimpleQuantity();
654          return this.high;
655        }
656        else if (name.equals("meaning")) {
657          this.meaning = new CodeableConcept();
658          return this.meaning;
659        }
660        else if (name.equals("age")) {
661          this.age = new Range();
662          return this.age;
663        }
664        else if (name.equals("text")) {
665          throw new FHIRException("Cannot call addChild on a primitive type Observation.text");
666        }
667        else
668          return super.addChild(name);
669      }
670
671      public ObservationReferenceRangeComponent copy() {
672        ObservationReferenceRangeComponent dst = new ObservationReferenceRangeComponent();
673        copyValues(dst);
674        dst.low = low == null ? null : low.copy();
675        dst.high = high == null ? null : high.copy();
676        dst.meaning = meaning == null ? null : meaning.copy();
677        dst.age = age == null ? null : age.copy();
678        dst.text = text == null ? null : text.copy();
679        return dst;
680      }
681
682      @Override
683      public boolean equalsDeep(Base other) {
684        if (!super.equalsDeep(other))
685          return false;
686        if (!(other instanceof ObservationReferenceRangeComponent))
687          return false;
688        ObservationReferenceRangeComponent o = (ObservationReferenceRangeComponent) other;
689        return compareDeep(low, o.low, true) && compareDeep(high, o.high, true) && compareDeep(meaning, o.meaning, true)
690           && compareDeep(age, o.age, true) && compareDeep(text, o.text, true);
691      }
692
693      @Override
694      public boolean equalsShallow(Base other) {
695        if (!super.equalsShallow(other))
696          return false;
697        if (!(other instanceof ObservationReferenceRangeComponent))
698          return false;
699        ObservationReferenceRangeComponent o = (ObservationReferenceRangeComponent) other;
700        return compareValues(text, o.text, true);
701      }
702
703      public boolean isEmpty() {
704        return super.isEmpty() && (low == null || low.isEmpty()) && (high == null || high.isEmpty())
705           && (meaning == null || meaning.isEmpty()) && (age == null || age.isEmpty()) && (text == null || text.isEmpty())
706          ;
707      }
708
709  public String fhirType() {
710    return "Observation.referenceRange";
711
712  }
713
714  }
715
716    @Block()
717    public static class ObservationRelatedComponent extends BackboneElement implements IBaseBackboneElement {
718        /**
719         * A code specifying the kind of relationship that exists with the target resource.
720         */
721        @Child(name = "type", type = {CodeType.class}, order=1, min=0, max=1, modifier=false, summary=false)
722        @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." )
723        protected Enumeration<ObservationRelationshipType> type;
724
725        /**
726         * A reference to the observation or [[[QuestionnaireResponse]]] resource that is related to this observation.
727         */
728        @Child(name = "target", type = {Observation.class, QuestionnaireResponse.class}, order=2, min=1, max=1, modifier=false, summary=false)
729        @Description(shortDefinition="Resource that is related to this one", formalDefinition="A reference to the observation or [[[QuestionnaireResponse]]] resource that is related to this observation." )
730        protected Reference target;
731
732        /**
733         * The actual object that is the target of the reference (A reference to the observation or [[[QuestionnaireResponse]]] resource that is related to this observation.)
734         */
735        protected Resource targetTarget;
736
737        private static final long serialVersionUID = 1541802577L;
738
739    /**
740     * Constructor
741     */
742      public ObservationRelatedComponent() {
743        super();
744      }
745
746    /**
747     * Constructor
748     */
749      public ObservationRelatedComponent(Reference target) {
750        super();
751        this.target = target;
752      }
753
754        /**
755         * @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
756         */
757        public Enumeration<ObservationRelationshipType> getTypeElement() { 
758          if (this.type == null)
759            if (Configuration.errorOnAutoCreate())
760              throw new Error("Attempt to auto-create ObservationRelatedComponent.type");
761            else if (Configuration.doAutoCreate())
762              this.type = new Enumeration<ObservationRelationshipType>(new ObservationRelationshipTypeEnumFactory()); // bb
763          return this.type;
764        }
765
766        public boolean hasTypeElement() { 
767          return this.type != null && !this.type.isEmpty();
768        }
769
770        public boolean hasType() { 
771          return this.type != null && !this.type.isEmpty();
772        }
773
774        /**
775         * @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
776         */
777        public ObservationRelatedComponent setTypeElement(Enumeration<ObservationRelationshipType> value) { 
778          this.type = value;
779          return this;
780        }
781
782        /**
783         * @return A code specifying the kind of relationship that exists with the target resource.
784         */
785        public ObservationRelationshipType getType() { 
786          return this.type == null ? null : this.type.getValue();
787        }
788
789        /**
790         * @param value A code specifying the kind of relationship that exists with the target resource.
791         */
792        public ObservationRelatedComponent setType(ObservationRelationshipType value) { 
793          if (value == null)
794            this.type = null;
795          else {
796            if (this.type == null)
797              this.type = new Enumeration<ObservationRelationshipType>(new ObservationRelationshipTypeEnumFactory());
798            this.type.setValue(value);
799          }
800          return this;
801        }
802
803        /**
804         * @return {@link #target} (A reference to the observation or [[[QuestionnaireResponse]]] resource that is related to this observation.)
805         */
806        public Reference getTarget() { 
807          if (this.target == null)
808            if (Configuration.errorOnAutoCreate())
809              throw new Error("Attempt to auto-create ObservationRelatedComponent.target");
810            else if (Configuration.doAutoCreate())
811              this.target = new Reference(); // cc
812          return this.target;
813        }
814
815        public boolean hasTarget() { 
816          return this.target != null && !this.target.isEmpty();
817        }
818
819        /**
820         * @param value {@link #target} (A reference to the observation or [[[QuestionnaireResponse]]] resource that is related to this observation.)
821         */
822        public ObservationRelatedComponent setTarget(Reference value) { 
823          this.target = value;
824          return this;
825        }
826
827        /**
828         * @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.)
829         */
830        public Resource getTargetTarget() { 
831          return this.targetTarget;
832        }
833
834        /**
835         * @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.)
836         */
837        public ObservationRelatedComponent setTargetTarget(Resource value) { 
838          this.targetTarget = value;
839          return this;
840        }
841
842        protected void listChildren(List<Property> childrenList) {
843          super.listChildren(childrenList);
844          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));
845          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));
846        }
847
848      @Override
849      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
850        switch (hash) {
851        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // Enumeration<ObservationRelationshipType>
852        case -880905839: /*target*/ return this.target == null ? new Base[0] : new Base[] {this.target}; // Reference
853        default: return super.getProperty(hash, name, checkValid);
854        }
855
856      }
857
858      @Override
859      public void setProperty(int hash, String name, Base value) throws FHIRException {
860        switch (hash) {
861        case 3575610: // type
862          this.type = new ObservationRelationshipTypeEnumFactory().fromType(value); // Enumeration<ObservationRelationshipType>
863          break;
864        case -880905839: // target
865          this.target = castToReference(value); // Reference
866          break;
867        default: super.setProperty(hash, name, value);
868        }
869
870      }
871
872      @Override
873      public void setProperty(String name, Base value) throws FHIRException {
874        if (name.equals("type"))
875          this.type = new ObservationRelationshipTypeEnumFactory().fromType(value); // Enumeration<ObservationRelationshipType>
876        else if (name.equals("target"))
877          this.target = castToReference(value); // Reference
878        else
879          super.setProperty(name, value);
880      }
881
882      @Override
883      public Base makeProperty(int hash, String name) throws FHIRException {
884        switch (hash) {
885        case 3575610: throw new FHIRException("Cannot make property type as it is not a complex type"); // Enumeration<ObservationRelationshipType>
886        case -880905839:  return getTarget(); // Reference
887        default: return super.makeProperty(hash, name);
888        }
889
890      }
891
892      @Override
893      public Base addChild(String name) throws FHIRException {
894        if (name.equals("type")) {
895          throw new FHIRException("Cannot call addChild on a primitive type Observation.type");
896        }
897        else if (name.equals("target")) {
898          this.target = new Reference();
899          return this.target;
900        }
901        else
902          return super.addChild(name);
903      }
904
905      public ObservationRelatedComponent copy() {
906        ObservationRelatedComponent dst = new ObservationRelatedComponent();
907        copyValues(dst);
908        dst.type = type == null ? null : type.copy();
909        dst.target = target == null ? null : target.copy();
910        return dst;
911      }
912
913      @Override
914      public boolean equalsDeep(Base other) {
915        if (!super.equalsDeep(other))
916          return false;
917        if (!(other instanceof ObservationRelatedComponent))
918          return false;
919        ObservationRelatedComponent o = (ObservationRelatedComponent) other;
920        return compareDeep(type, o.type, true) && compareDeep(target, o.target, true);
921      }
922
923      @Override
924      public boolean equalsShallow(Base other) {
925        if (!super.equalsShallow(other))
926          return false;
927        if (!(other instanceof ObservationRelatedComponent))
928          return false;
929        ObservationRelatedComponent o = (ObservationRelatedComponent) other;
930        return compareValues(type, o.type, true);
931      }
932
933      public boolean isEmpty() {
934        return super.isEmpty() && (type == null || type.isEmpty()) && (target == null || target.isEmpty())
935          ;
936      }
937
938  public String fhirType() {
939    return "Observation.related";
940
941  }
942
943  }
944
945    @Block()
946    public static class ObservationComponentComponent extends BackboneElement implements IBaseBackboneElement {
947        /**
948         * Describes what was observed. Sometimes this is called the observation "code".
949         */
950        @Child(name = "code", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=true)
951        @Description(shortDefinition="Type of component observation (code / type)", formalDefinition="Describes what was observed. Sometimes this is called the observation \"code\"." )
952        protected CodeableConcept code;
953
954        /**
955         * The information determined as a result of making the observation, if the information has a simple value.
956         */
957        @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)
958        @Description(shortDefinition="Actual component result", formalDefinition="The information determined as a result of making the observation, if the information has a simple value." )
959        protected Type value;
960
961        /**
962         * Provides a reason why the expected value in the element Observation.value[x] is missing.
963         */
964        @Child(name = "dataAbsentReason", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=false)
965        @Description(shortDefinition="Why the component result is missing", formalDefinition="Provides a reason why the expected value in the element Observation.value[x] is missing." )
966        protected CodeableConcept dataAbsentReason;
967
968        /**
969         * Guidance on how to interpret the value by comparison to a normal or recommended range.
970         */
971        @Child(name = "referenceRange", type = {ObservationReferenceRangeComponent.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
972        @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." )
973        protected List<ObservationReferenceRangeComponent> referenceRange;
974
975        private static final long serialVersionUID = 946602904L;
976
977    /**
978     * Constructor
979     */
980      public ObservationComponentComponent() {
981        super();
982      }
983
984    /**
985     * Constructor
986     */
987      public ObservationComponentComponent(CodeableConcept code) {
988        super();
989        this.code = code;
990      }
991
992        /**
993         * @return {@link #code} (Describes what was observed. Sometimes this is called the observation "code".)
994         */
995        public CodeableConcept getCode() { 
996          if (this.code == null)
997            if (Configuration.errorOnAutoCreate())
998              throw new Error("Attempt to auto-create ObservationComponentComponent.code");
999            else if (Configuration.doAutoCreate())
1000              this.code = new CodeableConcept(); // cc
1001          return this.code;
1002        }
1003
1004        public boolean hasCode() { 
1005          return this.code != null && !this.code.isEmpty();
1006        }
1007
1008        /**
1009         * @param value {@link #code} (Describes what was observed. Sometimes this is called the observation "code".)
1010         */
1011        public ObservationComponentComponent setCode(CodeableConcept value) { 
1012          this.code = value;
1013          return this;
1014        }
1015
1016        /**
1017         * @return {@link #value} (The information determined as a result of making the observation, if the information has a simple value.)
1018         */
1019        public Type getValue() { 
1020          return this.value;
1021        }
1022
1023        /**
1024         * @return {@link #value} (The information determined as a result of making the observation, if the information has a simple value.)
1025         */
1026        public Quantity getValueQuantity() throws FHIRException { 
1027          if (!(this.value instanceof Quantity))
1028            throw new FHIRException("Type mismatch: the type Quantity was expected, but "+this.value.getClass().getName()+" was encountered");
1029          return (Quantity) this.value;
1030        }
1031
1032        public boolean hasValueQuantity() { 
1033          return this.value instanceof Quantity;
1034        }
1035
1036        /**
1037         * @return {@link #value} (The information determined as a result of making the observation, if the information has a simple value.)
1038         */
1039        public CodeableConcept getValueCodeableConcept() throws FHIRException { 
1040          if (!(this.value instanceof CodeableConcept))
1041            throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.value.getClass().getName()+" was encountered");
1042          return (CodeableConcept) this.value;
1043        }
1044
1045        public boolean hasValueCodeableConcept() { 
1046          return this.value instanceof CodeableConcept;
1047        }
1048
1049        /**
1050         * @return {@link #value} (The information determined as a result of making the observation, if the information has a simple value.)
1051         */
1052        public StringType getValueStringType() throws FHIRException { 
1053          if (!(this.value instanceof StringType))
1054            throw new FHIRException("Type mismatch: the type StringType was expected, but "+this.value.getClass().getName()+" was encountered");
1055          return (StringType) this.value;
1056        }
1057
1058        public boolean hasValueStringType() { 
1059          return this.value instanceof StringType;
1060        }
1061
1062        /**
1063         * @return {@link #value} (The information determined as a result of making the observation, if the information has a simple value.)
1064         */
1065        public Range getValueRange() throws FHIRException { 
1066          if (!(this.value instanceof Range))
1067            throw new FHIRException("Type mismatch: the type Range was expected, but "+this.value.getClass().getName()+" was encountered");
1068          return (Range) this.value;
1069        }
1070
1071        public boolean hasValueRange() { 
1072          return this.value instanceof Range;
1073        }
1074
1075        /**
1076         * @return {@link #value} (The information determined as a result of making the observation, if the information has a simple value.)
1077         */
1078        public Ratio getValueRatio() throws FHIRException { 
1079          if (!(this.value instanceof Ratio))
1080            throw new FHIRException("Type mismatch: the type Ratio was expected, but "+this.value.getClass().getName()+" was encountered");
1081          return (Ratio) this.value;
1082        }
1083
1084        public boolean hasValueRatio() { 
1085          return this.value instanceof Ratio;
1086        }
1087
1088        /**
1089         * @return {@link #value} (The information determined as a result of making the observation, if the information has a simple value.)
1090         */
1091        public SampledData getValueSampledData() throws FHIRException { 
1092          if (!(this.value instanceof SampledData))
1093            throw new FHIRException("Type mismatch: the type SampledData was expected, but "+this.value.getClass().getName()+" was encountered");
1094          return (SampledData) this.value;
1095        }
1096
1097        public boolean hasValueSampledData() { 
1098          return this.value instanceof SampledData;
1099        }
1100
1101        /**
1102         * @return {@link #value} (The information determined as a result of making the observation, if the information has a simple value.)
1103         */
1104        public Attachment getValueAttachment() throws FHIRException { 
1105          if (!(this.value instanceof Attachment))
1106            throw new FHIRException("Type mismatch: the type Attachment was expected, but "+this.value.getClass().getName()+" was encountered");
1107          return (Attachment) this.value;
1108        }
1109
1110        public boolean hasValueAttachment() { 
1111          return this.value instanceof Attachment;
1112        }
1113
1114        /**
1115         * @return {@link #value} (The information determined as a result of making the observation, if the information has a simple value.)
1116         */
1117        public TimeType getValueTimeType() throws FHIRException { 
1118          if (!(this.value instanceof TimeType))
1119            throw new FHIRException("Type mismatch: the type TimeType was expected, but "+this.value.getClass().getName()+" was encountered");
1120          return (TimeType) this.value;
1121        }
1122
1123        public boolean hasValueTimeType() { 
1124          return this.value instanceof TimeType;
1125        }
1126
1127        /**
1128         * @return {@link #value} (The information determined as a result of making the observation, if the information has a simple value.)
1129         */
1130        public DateTimeType getValueDateTimeType() throws FHIRException { 
1131          if (!(this.value instanceof DateTimeType))
1132            throw new FHIRException("Type mismatch: the type DateTimeType was expected, but "+this.value.getClass().getName()+" was encountered");
1133          return (DateTimeType) this.value;
1134        }
1135
1136        public boolean hasValueDateTimeType() { 
1137          return this.value instanceof DateTimeType;
1138        }
1139
1140        /**
1141         * @return {@link #value} (The information determined as a result of making the observation, if the information has a simple value.)
1142         */
1143        public Period getValuePeriod() throws FHIRException { 
1144          if (!(this.value instanceof Period))
1145            throw new FHIRException("Type mismatch: the type Period was expected, but "+this.value.getClass().getName()+" was encountered");
1146          return (Period) this.value;
1147        }
1148
1149        public boolean hasValuePeriod() { 
1150          return this.value instanceof Period;
1151        }
1152
1153        public boolean hasValue() { 
1154          return this.value != null && !this.value.isEmpty();
1155        }
1156
1157        /**
1158         * @param value {@link #value} (The information determined as a result of making the observation, if the information has a simple value.)
1159         */
1160        public ObservationComponentComponent setValue(Type value) { 
1161          this.value = value;
1162          return this;
1163        }
1164
1165        /**
1166         * @return {@link #dataAbsentReason} (Provides a reason why the expected value in the element Observation.value[x] is missing.)
1167         */
1168        public CodeableConcept getDataAbsentReason() { 
1169          if (this.dataAbsentReason == null)
1170            if (Configuration.errorOnAutoCreate())
1171              throw new Error("Attempt to auto-create ObservationComponentComponent.dataAbsentReason");
1172            else if (Configuration.doAutoCreate())
1173              this.dataAbsentReason = new CodeableConcept(); // cc
1174          return this.dataAbsentReason;
1175        }
1176
1177        public boolean hasDataAbsentReason() { 
1178          return this.dataAbsentReason != null && !this.dataAbsentReason.isEmpty();
1179        }
1180
1181        /**
1182         * @param value {@link #dataAbsentReason} (Provides a reason why the expected value in the element Observation.value[x] is missing.)
1183         */
1184        public ObservationComponentComponent setDataAbsentReason(CodeableConcept value) { 
1185          this.dataAbsentReason = value;
1186          return this;
1187        }
1188
1189        /**
1190         * @return {@link #referenceRange} (Guidance on how to interpret the value by comparison to a normal or recommended range.)
1191         */
1192        public List<ObservationReferenceRangeComponent> getReferenceRange() { 
1193          if (this.referenceRange == null)
1194            this.referenceRange = new ArrayList<ObservationReferenceRangeComponent>();
1195          return this.referenceRange;
1196        }
1197
1198        public boolean hasReferenceRange() { 
1199          if (this.referenceRange == null)
1200            return false;
1201          for (ObservationReferenceRangeComponent item : this.referenceRange)
1202            if (!item.isEmpty())
1203              return true;
1204          return false;
1205        }
1206
1207        /**
1208         * @return {@link #referenceRange} (Guidance on how to interpret the value by comparison to a normal or recommended range.)
1209         */
1210    // syntactic sugar
1211        public ObservationReferenceRangeComponent addReferenceRange() { //3
1212          ObservationReferenceRangeComponent t = new ObservationReferenceRangeComponent();
1213          if (this.referenceRange == null)
1214            this.referenceRange = new ArrayList<ObservationReferenceRangeComponent>();
1215          this.referenceRange.add(t);
1216          return t;
1217        }
1218
1219    // syntactic sugar
1220        public ObservationComponentComponent addReferenceRange(ObservationReferenceRangeComponent t) { //3
1221          if (t == null)
1222            return this;
1223          if (this.referenceRange == null)
1224            this.referenceRange = new ArrayList<ObservationReferenceRangeComponent>();
1225          this.referenceRange.add(t);
1226          return this;
1227        }
1228
1229        protected void listChildren(List<Property> childrenList) {
1230          super.listChildren(childrenList);
1231          childrenList.add(new Property("code", "CodeableConcept", "Describes what was observed. Sometimes this is called the observation \"code\".", 0, java.lang.Integer.MAX_VALUE, code));
1232          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));
1233          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));
1234          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));
1235        }
1236
1237      @Override
1238      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1239        switch (hash) {
1240        case 3059181: /*code*/ return this.code == null ? new Base[0] : new Base[] {this.code}; // CodeableConcept
1241        case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // Type
1242        case 1034315687: /*dataAbsentReason*/ return this.dataAbsentReason == null ? new Base[0] : new Base[] {this.dataAbsentReason}; // CodeableConcept
1243        case -1912545102: /*referenceRange*/ return this.referenceRange == null ? new Base[0] : this.referenceRange.toArray(new Base[this.referenceRange.size()]); // ObservationReferenceRangeComponent
1244        default: return super.getProperty(hash, name, checkValid);
1245        }
1246
1247      }
1248
1249      @Override
1250      public void setProperty(int hash, String name, Base value) throws FHIRException {
1251        switch (hash) {
1252        case 3059181: // code
1253          this.code = castToCodeableConcept(value); // CodeableConcept
1254          break;
1255        case 111972721: // value
1256          this.value = (Type) value; // Type
1257          break;
1258        case 1034315687: // dataAbsentReason
1259          this.dataAbsentReason = castToCodeableConcept(value); // CodeableConcept
1260          break;
1261        case -1912545102: // referenceRange
1262          this.getReferenceRange().add((ObservationReferenceRangeComponent) value); // ObservationReferenceRangeComponent
1263          break;
1264        default: super.setProperty(hash, name, value);
1265        }
1266
1267      }
1268
1269      @Override
1270      public void setProperty(String name, Base value) throws FHIRException {
1271        if (name.equals("code"))
1272          this.code = castToCodeableConcept(value); // CodeableConcept
1273        else if (name.equals("value[x]"))
1274          this.value = (Type) value; // Type
1275        else if (name.equals("dataAbsentReason"))
1276          this.dataAbsentReason = castToCodeableConcept(value); // CodeableConcept
1277        else if (name.equals("referenceRange"))
1278          this.getReferenceRange().add((ObservationReferenceRangeComponent) value);
1279        else
1280          super.setProperty(name, value);
1281      }
1282
1283      @Override
1284      public Base makeProperty(int hash, String name) throws FHIRException {
1285        switch (hash) {
1286        case 3059181:  return getCode(); // CodeableConcept
1287        case -1410166417:  return getValue(); // Type
1288        case 1034315687:  return getDataAbsentReason(); // CodeableConcept
1289        case -1912545102:  return addReferenceRange(); // ObservationReferenceRangeComponent
1290        default: return super.makeProperty(hash, name);
1291        }
1292
1293      }
1294
1295      @Override
1296      public Base addChild(String name) throws FHIRException {
1297        if (name.equals("code")) {
1298          this.code = new CodeableConcept();
1299          return this.code;
1300        }
1301        else if (name.equals("valueQuantity")) {
1302          this.value = new Quantity();
1303          return this.value;
1304        }
1305        else if (name.equals("valueCodeableConcept")) {
1306          this.value = new CodeableConcept();
1307          return this.value;
1308        }
1309        else if (name.equals("valueString")) {
1310          this.value = new StringType();
1311          return this.value;
1312        }
1313        else if (name.equals("valueRange")) {
1314          this.value = new Range();
1315          return this.value;
1316        }
1317        else if (name.equals("valueRatio")) {
1318          this.value = new Ratio();
1319          return this.value;
1320        }
1321        else if (name.equals("valueSampledData")) {
1322          this.value = new SampledData();
1323          return this.value;
1324        }
1325        else if (name.equals("valueAttachment")) {
1326          this.value = new Attachment();
1327          return this.value;
1328        }
1329        else if (name.equals("valueTime")) {
1330          this.value = new TimeType();
1331          return this.value;
1332        }
1333        else if (name.equals("valueDateTime")) {
1334          this.value = new DateTimeType();
1335          return this.value;
1336        }
1337        else if (name.equals("valuePeriod")) {
1338          this.value = new Period();
1339          return this.value;
1340        }
1341        else if (name.equals("dataAbsentReason")) {
1342          this.dataAbsentReason = new CodeableConcept();
1343          return this.dataAbsentReason;
1344        }
1345        else if (name.equals("referenceRange")) {
1346          return addReferenceRange();
1347        }
1348        else
1349          return super.addChild(name);
1350      }
1351
1352      public ObservationComponentComponent copy() {
1353        ObservationComponentComponent dst = new ObservationComponentComponent();
1354        copyValues(dst);
1355        dst.code = code == null ? null : code.copy();
1356        dst.value = value == null ? null : value.copy();
1357        dst.dataAbsentReason = dataAbsentReason == null ? null : dataAbsentReason.copy();
1358        if (referenceRange != null) {
1359          dst.referenceRange = new ArrayList<ObservationReferenceRangeComponent>();
1360          for (ObservationReferenceRangeComponent i : referenceRange)
1361            dst.referenceRange.add(i.copy());
1362        };
1363        return dst;
1364      }
1365
1366      @Override
1367      public boolean equalsDeep(Base other) {
1368        if (!super.equalsDeep(other))
1369          return false;
1370        if (!(other instanceof ObservationComponentComponent))
1371          return false;
1372        ObservationComponentComponent o = (ObservationComponentComponent) other;
1373        return compareDeep(code, o.code, true) && compareDeep(value, o.value, true) && compareDeep(dataAbsentReason, o.dataAbsentReason, true)
1374           && compareDeep(referenceRange, o.referenceRange, true);
1375      }
1376
1377      @Override
1378      public boolean equalsShallow(Base other) {
1379        if (!super.equalsShallow(other))
1380          return false;
1381        if (!(other instanceof ObservationComponentComponent))
1382          return false;
1383        ObservationComponentComponent o = (ObservationComponentComponent) other;
1384        return true;
1385      }
1386
1387      public boolean isEmpty() {
1388        return super.isEmpty() && (code == null || code.isEmpty()) && (value == null || value.isEmpty())
1389           && (dataAbsentReason == null || dataAbsentReason.isEmpty()) && (referenceRange == null || referenceRange.isEmpty())
1390          ;
1391      }
1392
1393  public String fhirType() {
1394    return "Observation.component";
1395
1396  }
1397
1398  }
1399
1400    /**
1401     * A unique identifier for the simple observation instance.
1402     */
1403    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1404    @Description(shortDefinition="Unique Id for this particular observation", formalDefinition="A unique identifier for the simple observation instance." )
1405    protected List<Identifier> identifier;
1406
1407    /**
1408     * The status of the result value.
1409     */
1410    @Child(name = "status", type = {CodeType.class}, order=1, min=1, max=1, modifier=true, summary=true)
1411    @Description(shortDefinition="registered | preliminary | final | amended +", formalDefinition="The status of the result value." )
1412    protected Enumeration<ObservationStatus> status;
1413
1414    /**
1415     * A code that classifies the general type of observation being made.  This is used  for searching, sorting and display purposes.
1416     */
1417    @Child(name = "category", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
1418    @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." )
1419    protected CodeableConcept category;
1420
1421    /**
1422     * Describes what was observed. Sometimes this is called the observation "name".
1423     */
1424    @Child(name = "code", type = {CodeableConcept.class}, order=3, min=1, max=1, modifier=false, summary=true)
1425    @Description(shortDefinition="Type of observation (code / type)", formalDefinition="Describes what was observed. Sometimes this is called the observation \"name\"." )
1426    protected CodeableConcept code;
1427
1428    /**
1429     * 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.
1430     */
1431    @Child(name = "subject", type = {Patient.class, Group.class, Device.class, Location.class}, order=4, min=0, max=1, modifier=false, summary=true)
1432    @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." )
1433    protected Reference subject;
1434
1435    /**
1436     * 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.)
1437     */
1438    protected Resource subjectTarget;
1439
1440    /**
1441     * The healthcare event  (e.g. a patient and healthcare provider interaction) during which this observation is made.
1442     */
1443    @Child(name = "encounter", type = {Encounter.class}, order=5, min=0, max=1, modifier=false, summary=false)
1444    @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." )
1445    protected Reference encounter;
1446
1447    /**
1448     * 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.)
1449     */
1450    protected Encounter encounterTarget;
1451
1452    /**
1453     * 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.
1454     */
1455    @Child(name = "effective", type = {DateTimeType.class, Period.class}, order=6, min=0, max=1, modifier=false, summary=true)
1456    @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." )
1457    protected Type effective;
1458
1459    /**
1460     * The date and time this observation was made available to providers, typically after the results have been reviewed and verified.
1461     */
1462    @Child(name = "issued", type = {InstantType.class}, order=7, min=0, max=1, modifier=false, summary=true)
1463    @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." )
1464    protected InstantType issued;
1465
1466    /**
1467     * Who was responsible for asserting the observed value as "true".
1468     */
1469    @Child(name = "performer", type = {Practitioner.class, Organization.class, Patient.class, RelatedPerson.class}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1470    @Description(shortDefinition="Who is responsible for the observation", formalDefinition="Who was responsible for asserting the observed value as \"true\"." )
1471    protected List<Reference> performer;
1472    /**
1473     * The actual objects that are the target of the reference (Who was responsible for asserting the observed value as "true".)
1474     */
1475    protected List<Resource> performerTarget;
1476
1477
1478    /**
1479     * The information determined as a result of making the observation, if the information has a simple value.
1480     */
1481    @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)
1482    @Description(shortDefinition="Actual result", formalDefinition="The information determined as a result of making the observation, if the information has a simple value." )
1483    protected Type value;
1484
1485    /**
1486     * Provides a reason why the expected value in the element Observation.value[x] is missing.
1487     */
1488    @Child(name = "dataAbsentReason", type = {CodeableConcept.class}, order=10, min=0, max=1, modifier=false, summary=false)
1489    @Description(shortDefinition="Why the result is missing", formalDefinition="Provides a reason why the expected value in the element Observation.value[x] is missing." )
1490    protected CodeableConcept dataAbsentReason;
1491
1492    /**
1493     * 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.
1494     */
1495    @Child(name = "interpretation", type = {CodeableConcept.class}, order=11, min=0, max=1, modifier=false, summary=false)
1496    @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." )
1497    protected CodeableConcept interpretation;
1498
1499    /**
1500     * 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.
1501     */
1502    @Child(name = "comment", type = {StringType.class}, order=12, min=0, max=1, modifier=false, summary=false)
1503    @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." )
1504    protected StringType comment;
1505
1506    /**
1507     * Indicates the site on the subject's body where the observation was made (i.e. the target site).
1508     */
1509    @Child(name = "bodySite", type = {CodeableConcept.class}, order=13, min=0, max=1, modifier=false, summary=false)
1510    @Description(shortDefinition="Observed body part", formalDefinition="Indicates the site on the subject's body where the observation was made (i.e. the target site)." )
1511    protected CodeableConcept bodySite;
1512
1513    /**
1514     * Indicates the mechanism used to perform the observation.
1515     */
1516    @Child(name = "method", type = {CodeableConcept.class}, order=14, min=0, max=1, modifier=false, summary=false)
1517    @Description(shortDefinition="How it was done", formalDefinition="Indicates the mechanism used to perform the observation." )
1518    protected CodeableConcept method;
1519
1520    /**
1521     * The specimen that was used when this observation was made.
1522     */
1523    @Child(name = "specimen", type = {Specimen.class}, order=15, min=0, max=1, modifier=false, summary=false)
1524    @Description(shortDefinition="Specimen used for this observation", formalDefinition="The specimen that was used when this observation was made." )
1525    protected Reference specimen;
1526
1527    /**
1528     * The actual object that is the target of the reference (The specimen that was used when this observation was made.)
1529     */
1530    protected Specimen specimenTarget;
1531
1532    /**
1533     * The device used to generate the observation data.
1534     */
1535    @Child(name = "device", type = {Device.class, DeviceMetric.class}, order=16, min=0, max=1, modifier=false, summary=false)
1536    @Description(shortDefinition="(Measurement) Device", formalDefinition="The device used to generate the observation data." )
1537    protected Reference device;
1538
1539    /**
1540     * The actual object that is the target of the reference (The device used to generate the observation data.)
1541     */
1542    protected Resource deviceTarget;
1543
1544    /**
1545     * Guidance on how to interpret the value by comparison to a normal or recommended range.
1546     */
1547    @Child(name = "referenceRange", type = {}, order=17, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1548    @Description(shortDefinition="Provides guide for interpretation", formalDefinition="Guidance on how to interpret the value by comparison to a normal or recommended range." )
1549    protected List<ObservationReferenceRangeComponent> referenceRange;
1550
1551    /**
1552     * A  reference to another resource (usually another Observation but could  also be a QuestionnaireAnswer) whose relationship is defined by the relationship type code.
1553     */
1554    @Child(name = "related", type = {}, order=18, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1555    @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." )
1556    protected List<ObservationRelatedComponent> related;
1557
1558    /**
1559     * 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.
1560     */
1561    @Child(name = "component", type = {}, order=19, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1562    @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." )
1563    protected List<ObservationComponentComponent> component;
1564
1565    private static final long serialVersionUID = -1812700333L;
1566
1567  /**
1568   * Constructor
1569   */
1570    public Observation() {
1571      super();
1572    }
1573
1574  /**
1575   * Constructor
1576   */
1577    public Observation(Enumeration<ObservationStatus> status, CodeableConcept code) {
1578      super();
1579      this.status = status;
1580      this.code = code;
1581    }
1582
1583    /**
1584     * @return {@link #identifier} (A unique identifier for the simple observation instance.)
1585     */
1586    public List<Identifier> getIdentifier() { 
1587      if (this.identifier == null)
1588        this.identifier = new ArrayList<Identifier>();
1589      return this.identifier;
1590    }
1591
1592    public boolean hasIdentifier() { 
1593      if (this.identifier == null)
1594        return false;
1595      for (Identifier item : this.identifier)
1596        if (!item.isEmpty())
1597          return true;
1598      return false;
1599    }
1600
1601    /**
1602     * @return {@link #identifier} (A unique identifier for the simple observation instance.)
1603     */
1604    // syntactic sugar
1605    public Identifier addIdentifier() { //3
1606      Identifier t = new Identifier();
1607      if (this.identifier == null)
1608        this.identifier = new ArrayList<Identifier>();
1609      this.identifier.add(t);
1610      return t;
1611    }
1612
1613    // syntactic sugar
1614    public Observation addIdentifier(Identifier t) { //3
1615      if (t == null)
1616        return this;
1617      if (this.identifier == null)
1618        this.identifier = new ArrayList<Identifier>();
1619      this.identifier.add(t);
1620      return this;
1621    }
1622
1623    /**
1624     * @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
1625     */
1626    public Enumeration<ObservationStatus> getStatusElement() { 
1627      if (this.status == null)
1628        if (Configuration.errorOnAutoCreate())
1629          throw new Error("Attempt to auto-create Observation.status");
1630        else if (Configuration.doAutoCreate())
1631          this.status = new Enumeration<ObservationStatus>(new ObservationStatusEnumFactory()); // bb
1632      return this.status;
1633    }
1634
1635    public boolean hasStatusElement() { 
1636      return this.status != null && !this.status.isEmpty();
1637    }
1638
1639    public boolean hasStatus() { 
1640      return this.status != null && !this.status.isEmpty();
1641    }
1642
1643    /**
1644     * @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
1645     */
1646    public Observation setStatusElement(Enumeration<ObservationStatus> value) { 
1647      this.status = value;
1648      return this;
1649    }
1650
1651    /**
1652     * @return The status of the result value.
1653     */
1654    public ObservationStatus getStatus() { 
1655      return this.status == null ? null : this.status.getValue();
1656    }
1657
1658    /**
1659     * @param value The status of the result value.
1660     */
1661    public Observation setStatus(ObservationStatus value) { 
1662        if (this.status == null)
1663          this.status = new Enumeration<ObservationStatus>(new ObservationStatusEnumFactory());
1664        this.status.setValue(value);
1665      return this;
1666    }
1667
1668    /**
1669     * @return {@link #category} (A code that classifies the general type of observation being made.  This is used  for searching, sorting and display purposes.)
1670     */
1671    public CodeableConcept getCategory() { 
1672      if (this.category == null)
1673        if (Configuration.errorOnAutoCreate())
1674          throw new Error("Attempt to auto-create Observation.category");
1675        else if (Configuration.doAutoCreate())
1676          this.category = new CodeableConcept(); // cc
1677      return this.category;
1678    }
1679
1680    public boolean hasCategory() { 
1681      return this.category != null && !this.category.isEmpty();
1682    }
1683
1684    /**
1685     * @param value {@link #category} (A code that classifies the general type of observation being made.  This is used  for searching, sorting and display purposes.)
1686     */
1687    public Observation setCategory(CodeableConcept value) { 
1688      this.category = value;
1689      return this;
1690    }
1691
1692    /**
1693     * @return {@link #code} (Describes what was observed. Sometimes this is called the observation "name".)
1694     */
1695    public CodeableConcept getCode() { 
1696      if (this.code == null)
1697        if (Configuration.errorOnAutoCreate())
1698          throw new Error("Attempt to auto-create Observation.code");
1699        else if (Configuration.doAutoCreate())
1700          this.code = new CodeableConcept(); // cc
1701      return this.code;
1702    }
1703
1704    public boolean hasCode() { 
1705      return this.code != null && !this.code.isEmpty();
1706    }
1707
1708    /**
1709     * @param value {@link #code} (Describes what was observed. Sometimes this is called the observation "name".)
1710     */
1711    public Observation setCode(CodeableConcept value) { 
1712      this.code = value;
1713      return this;
1714    }
1715
1716    /**
1717     * @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.)
1718     */
1719    public Reference getSubject() { 
1720      if (this.subject == null)
1721        if (Configuration.errorOnAutoCreate())
1722          throw new Error("Attempt to auto-create Observation.subject");
1723        else if (Configuration.doAutoCreate())
1724          this.subject = new Reference(); // cc
1725      return this.subject;
1726    }
1727
1728    public boolean hasSubject() { 
1729      return this.subject != null && !this.subject.isEmpty();
1730    }
1731
1732    /**
1733     * @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.)
1734     */
1735    public Observation setSubject(Reference value) { 
1736      this.subject = value;
1737      return this;
1738    }
1739
1740    /**
1741     * @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.)
1742     */
1743    public Resource getSubjectTarget() { 
1744      return this.subjectTarget;
1745    }
1746
1747    /**
1748     * @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.)
1749     */
1750    public Observation setSubjectTarget(Resource value) { 
1751      this.subjectTarget = value;
1752      return this;
1753    }
1754
1755    /**
1756     * @return {@link #encounter} (The healthcare event  (e.g. a patient and healthcare provider interaction) during which this observation is made.)
1757     */
1758    public Reference getEncounter() { 
1759      if (this.encounter == null)
1760        if (Configuration.errorOnAutoCreate())
1761          throw new Error("Attempt to auto-create Observation.encounter");
1762        else if (Configuration.doAutoCreate())
1763          this.encounter = new Reference(); // cc
1764      return this.encounter;
1765    }
1766
1767    public boolean hasEncounter() { 
1768      return this.encounter != null && !this.encounter.isEmpty();
1769    }
1770
1771    /**
1772     * @param value {@link #encounter} (The healthcare event  (e.g. a patient and healthcare provider interaction) during which this observation is made.)
1773     */
1774    public Observation setEncounter(Reference value) { 
1775      this.encounter = value;
1776      return this;
1777    }
1778
1779    /**
1780     * @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.)
1781     */
1782    public Encounter getEncounterTarget() { 
1783      if (this.encounterTarget == null)
1784        if (Configuration.errorOnAutoCreate())
1785          throw new Error("Attempt to auto-create Observation.encounter");
1786        else if (Configuration.doAutoCreate())
1787          this.encounterTarget = new Encounter(); // aa
1788      return this.encounterTarget;
1789    }
1790
1791    /**
1792     * @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.)
1793     */
1794    public Observation setEncounterTarget(Encounter value) { 
1795      this.encounterTarget = value;
1796      return this;
1797    }
1798
1799    /**
1800     * @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.)
1801     */
1802    public Type getEffective() { 
1803      return this.effective;
1804    }
1805
1806    /**
1807     * @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.)
1808     */
1809    public DateTimeType getEffectiveDateTimeType() throws FHIRException { 
1810      if (!(this.effective instanceof DateTimeType))
1811        throw new FHIRException("Type mismatch: the type DateTimeType was expected, but "+this.effective.getClass().getName()+" was encountered");
1812      return (DateTimeType) this.effective;
1813    }
1814
1815    public boolean hasEffectiveDateTimeType() { 
1816      return this.effective instanceof DateTimeType;
1817    }
1818
1819    /**
1820     * @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.)
1821     */
1822    public Period getEffectivePeriod() throws FHIRException { 
1823      if (!(this.effective instanceof Period))
1824        throw new FHIRException("Type mismatch: the type Period was expected, but "+this.effective.getClass().getName()+" was encountered");
1825      return (Period) this.effective;
1826    }
1827
1828    public boolean hasEffectivePeriod() { 
1829      return this.effective instanceof Period;
1830    }
1831
1832    public boolean hasEffective() { 
1833      return this.effective != null && !this.effective.isEmpty();
1834    }
1835
1836    /**
1837     * @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.)
1838     */
1839    public Observation setEffective(Type value) { 
1840      this.effective = value;
1841      return this;
1842    }
1843
1844    /**
1845     * @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
1846     */
1847    public InstantType getIssuedElement() { 
1848      if (this.issued == null)
1849        if (Configuration.errorOnAutoCreate())
1850          throw new Error("Attempt to auto-create Observation.issued");
1851        else if (Configuration.doAutoCreate())
1852          this.issued = new InstantType(); // bb
1853      return this.issued;
1854    }
1855
1856    public boolean hasIssuedElement() { 
1857      return this.issued != null && !this.issued.isEmpty();
1858    }
1859
1860    public boolean hasIssued() { 
1861      return this.issued != null && !this.issued.isEmpty();
1862    }
1863
1864    /**
1865     * @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
1866     */
1867    public Observation setIssuedElement(InstantType value) { 
1868      this.issued = value;
1869      return this;
1870    }
1871
1872    /**
1873     * @return The date and time this observation was made available to providers, typically after the results have been reviewed and verified.
1874     */
1875    public Date getIssued() { 
1876      return this.issued == null ? null : this.issued.getValue();
1877    }
1878
1879    /**
1880     * @param value The date and time this observation was made available to providers, typically after the results have been reviewed and verified.
1881     */
1882    public Observation setIssued(Date value) { 
1883      if (value == null)
1884        this.issued = null;
1885      else {
1886        if (this.issued == null)
1887          this.issued = new InstantType();
1888        this.issued.setValue(value);
1889      }
1890      return this;
1891    }
1892
1893    /**
1894     * @return {@link #performer} (Who was responsible for asserting the observed value as "true".)
1895     */
1896    public List<Reference> getPerformer() { 
1897      if (this.performer == null)
1898        this.performer = new ArrayList<Reference>();
1899      return this.performer;
1900    }
1901
1902    public boolean hasPerformer() { 
1903      if (this.performer == null)
1904        return false;
1905      for (Reference item : this.performer)
1906        if (!item.isEmpty())
1907          return true;
1908      return false;
1909    }
1910
1911    /**
1912     * @return {@link #performer} (Who was responsible for asserting the observed value as "true".)
1913     */
1914    // syntactic sugar
1915    public Reference addPerformer() { //3
1916      Reference t = new Reference();
1917      if (this.performer == null)
1918        this.performer = new ArrayList<Reference>();
1919      this.performer.add(t);
1920      return t;
1921    }
1922
1923    // syntactic sugar
1924    public Observation addPerformer(Reference t) { //3
1925      if (t == null)
1926        return this;
1927      if (this.performer == null)
1928        this.performer = new ArrayList<Reference>();
1929      this.performer.add(t);
1930      return this;
1931    }
1932
1933    /**
1934     * @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".)
1935     */
1936    public List<Resource> getPerformerTarget() { 
1937      if (this.performerTarget == null)
1938        this.performerTarget = new ArrayList<Resource>();
1939      return this.performerTarget;
1940    }
1941
1942    /**
1943     * @return {@link #value} (The information determined as a result of making the observation, if the information has a simple value.)
1944     */
1945    public Type getValue() { 
1946      return this.value;
1947    }
1948
1949    /**
1950     * @return {@link #value} (The information determined as a result of making the observation, if the information has a simple value.)
1951     */
1952    public Quantity getValueQuantity() throws FHIRException { 
1953      if (!(this.value instanceof Quantity))
1954        throw new FHIRException("Type mismatch: the type Quantity was expected, but "+this.value.getClass().getName()+" was encountered");
1955      return (Quantity) this.value;
1956    }
1957
1958    public boolean hasValueQuantity() { 
1959      return this.value instanceof Quantity;
1960    }
1961
1962    /**
1963     * @return {@link #value} (The information determined as a result of making the observation, if the information has a simple value.)
1964     */
1965    public CodeableConcept getValueCodeableConcept() throws FHIRException { 
1966      if (!(this.value instanceof CodeableConcept))
1967        throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.value.getClass().getName()+" was encountered");
1968      return (CodeableConcept) this.value;
1969    }
1970
1971    public boolean hasValueCodeableConcept() { 
1972      return this.value instanceof CodeableConcept;
1973    }
1974
1975    /**
1976     * @return {@link #value} (The information determined as a result of making the observation, if the information has a simple value.)
1977     */
1978    public StringType getValueStringType() throws FHIRException { 
1979      if (!(this.value instanceof StringType))
1980        throw new FHIRException("Type mismatch: the type StringType was expected, but "+this.value.getClass().getName()+" was encountered");
1981      return (StringType) this.value;
1982    }
1983
1984    public boolean hasValueStringType() { 
1985      return this.value instanceof StringType;
1986    }
1987
1988    /**
1989     * @return {@link #value} (The information determined as a result of making the observation, if the information has a simple value.)
1990     */
1991    public Range getValueRange() throws FHIRException { 
1992      if (!(this.value instanceof Range))
1993        throw new FHIRException("Type mismatch: the type Range was expected, but "+this.value.getClass().getName()+" was encountered");
1994      return (Range) this.value;
1995    }
1996
1997    public boolean hasValueRange() { 
1998      return this.value instanceof Range;
1999    }
2000
2001    /**
2002     * @return {@link #value} (The information determined as a result of making the observation, if the information has a simple value.)
2003     */
2004    public Ratio getValueRatio() throws FHIRException { 
2005      if (!(this.value instanceof Ratio))
2006        throw new FHIRException("Type mismatch: the type Ratio was expected, but "+this.value.getClass().getName()+" was encountered");
2007      return (Ratio) this.value;
2008    }
2009
2010    public boolean hasValueRatio() { 
2011      return this.value instanceof Ratio;
2012    }
2013
2014    /**
2015     * @return {@link #value} (The information determined as a result of making the observation, if the information has a simple value.)
2016     */
2017    public SampledData getValueSampledData() throws FHIRException { 
2018      if (!(this.value instanceof SampledData))
2019        throw new FHIRException("Type mismatch: the type SampledData was expected, but "+this.value.getClass().getName()+" was encountered");
2020      return (SampledData) this.value;
2021    }
2022
2023    public boolean hasValueSampledData() { 
2024      return this.value instanceof SampledData;
2025    }
2026
2027    /**
2028     * @return {@link #value} (The information determined as a result of making the observation, if the information has a simple value.)
2029     */
2030    public Attachment getValueAttachment() throws FHIRException { 
2031      if (!(this.value instanceof Attachment))
2032        throw new FHIRException("Type mismatch: the type Attachment was expected, but "+this.value.getClass().getName()+" was encountered");
2033      return (Attachment) this.value;
2034    }
2035
2036    public boolean hasValueAttachment() { 
2037      return this.value instanceof Attachment;
2038    }
2039
2040    /**
2041     * @return {@link #value} (The information determined as a result of making the observation, if the information has a simple value.)
2042     */
2043    public TimeType getValueTimeType() throws FHIRException { 
2044      if (!(this.value instanceof TimeType))
2045        throw new FHIRException("Type mismatch: the type TimeType was expected, but "+this.value.getClass().getName()+" was encountered");
2046      return (TimeType) this.value;
2047    }
2048
2049    public boolean hasValueTimeType() { 
2050      return this.value instanceof TimeType;
2051    }
2052
2053    /**
2054     * @return {@link #value} (The information determined as a result of making the observation, if the information has a simple value.)
2055     */
2056    public DateTimeType getValueDateTimeType() throws FHIRException { 
2057      if (!(this.value instanceof DateTimeType))
2058        throw new FHIRException("Type mismatch: the type DateTimeType was expected, but "+this.value.getClass().getName()+" was encountered");
2059      return (DateTimeType) this.value;
2060    }
2061
2062    public boolean hasValueDateTimeType() { 
2063      return this.value instanceof DateTimeType;
2064    }
2065
2066    /**
2067     * @return {@link #value} (The information determined as a result of making the observation, if the information has a simple value.)
2068     */
2069    public Period getValuePeriod() throws FHIRException { 
2070      if (!(this.value instanceof Period))
2071        throw new FHIRException("Type mismatch: the type Period was expected, but "+this.value.getClass().getName()+" was encountered");
2072      return (Period) this.value;
2073    }
2074
2075    public boolean hasValuePeriod() { 
2076      return this.value instanceof Period;
2077    }
2078
2079    public boolean hasValue() { 
2080      return this.value != null && !this.value.isEmpty();
2081    }
2082
2083    /**
2084     * @param value {@link #value} (The information determined as a result of making the observation, if the information has a simple value.)
2085     */
2086    public Observation setValue(Type value) { 
2087      this.value = value;
2088      return this;
2089    }
2090
2091    /**
2092     * @return {@link #dataAbsentReason} (Provides a reason why the expected value in the element Observation.value[x] is missing.)
2093     */
2094    public CodeableConcept getDataAbsentReason() { 
2095      if (this.dataAbsentReason == null)
2096        if (Configuration.errorOnAutoCreate())
2097          throw new Error("Attempt to auto-create Observation.dataAbsentReason");
2098        else if (Configuration.doAutoCreate())
2099          this.dataAbsentReason = new CodeableConcept(); // cc
2100      return this.dataAbsentReason;
2101    }
2102
2103    public boolean hasDataAbsentReason() { 
2104      return this.dataAbsentReason != null && !this.dataAbsentReason.isEmpty();
2105    }
2106
2107    /**
2108     * @param value {@link #dataAbsentReason} (Provides a reason why the expected value in the element Observation.value[x] is missing.)
2109     */
2110    public Observation setDataAbsentReason(CodeableConcept value) { 
2111      this.dataAbsentReason = value;
2112      return this;
2113    }
2114
2115    /**
2116     * @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.)
2117     */
2118    public CodeableConcept getInterpretation() { 
2119      if (this.interpretation == null)
2120        if (Configuration.errorOnAutoCreate())
2121          throw new Error("Attempt to auto-create Observation.interpretation");
2122        else if (Configuration.doAutoCreate())
2123          this.interpretation = new CodeableConcept(); // cc
2124      return this.interpretation;
2125    }
2126
2127    public boolean hasInterpretation() { 
2128      return this.interpretation != null && !this.interpretation.isEmpty();
2129    }
2130
2131    /**
2132     * @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.)
2133     */
2134    public Observation setInterpretation(CodeableConcept value) { 
2135      this.interpretation = value;
2136      return this;
2137    }
2138
2139    /**
2140     * @return {@link #comment} (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 "getComment" gives direct access to the value
2141     */
2142    public StringType getCommentElement() { 
2143      if (this.comment == null)
2144        if (Configuration.errorOnAutoCreate())
2145          throw new Error("Attempt to auto-create Observation.comment");
2146        else if (Configuration.doAutoCreate())
2147          this.comment = new StringType(); // bb
2148      return this.comment;
2149    }
2150
2151    public boolean hasCommentElement() { 
2152      return this.comment != null && !this.comment.isEmpty();
2153    }
2154
2155    public boolean hasComment() { 
2156      return this.comment != null && !this.comment.isEmpty();
2157    }
2158
2159    /**
2160     * @param value {@link #comment} (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 "getComment" gives direct access to the value
2161     */
2162    public Observation setCommentElement(StringType value) { 
2163      this.comment = value;
2164      return this;
2165    }
2166
2167    /**
2168     * @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.
2169     */
2170    public String getComment() { 
2171      return this.comment == null ? null : this.comment.getValue();
2172    }
2173
2174    /**
2175     * @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.
2176     */
2177    public Observation setComment(String value) { 
2178      if (Utilities.noString(value))
2179        this.comment = null;
2180      else {
2181        if (this.comment == null)
2182          this.comment = new StringType();
2183        this.comment.setValue(value);
2184      }
2185      return this;
2186    }
2187
2188    /**
2189     * @return {@link #bodySite} (Indicates the site on the subject's body where the observation was made (i.e. the target site).)
2190     */
2191    public CodeableConcept getBodySite() { 
2192      if (this.bodySite == null)
2193        if (Configuration.errorOnAutoCreate())
2194          throw new Error("Attempt to auto-create Observation.bodySite");
2195        else if (Configuration.doAutoCreate())
2196          this.bodySite = new CodeableConcept(); // cc
2197      return this.bodySite;
2198    }
2199
2200    public boolean hasBodySite() { 
2201      return this.bodySite != null && !this.bodySite.isEmpty();
2202    }
2203
2204    /**
2205     * @param value {@link #bodySite} (Indicates the site on the subject's body where the observation was made (i.e. the target site).)
2206     */
2207    public Observation setBodySite(CodeableConcept value) { 
2208      this.bodySite = value;
2209      return this;
2210    }
2211
2212    /**
2213     * @return {@link #method} (Indicates the mechanism used to perform the observation.)
2214     */
2215    public CodeableConcept getMethod() { 
2216      if (this.method == null)
2217        if (Configuration.errorOnAutoCreate())
2218          throw new Error("Attempt to auto-create Observation.method");
2219        else if (Configuration.doAutoCreate())
2220          this.method = new CodeableConcept(); // cc
2221      return this.method;
2222    }
2223
2224    public boolean hasMethod() { 
2225      return this.method != null && !this.method.isEmpty();
2226    }
2227
2228    /**
2229     * @param value {@link #method} (Indicates the mechanism used to perform the observation.)
2230     */
2231    public Observation setMethod(CodeableConcept value) { 
2232      this.method = value;
2233      return this;
2234    }
2235
2236    /**
2237     * @return {@link #specimen} (The specimen that was used when this observation was made.)
2238     */
2239    public Reference getSpecimen() { 
2240      if (this.specimen == null)
2241        if (Configuration.errorOnAutoCreate())
2242          throw new Error("Attempt to auto-create Observation.specimen");
2243        else if (Configuration.doAutoCreate())
2244          this.specimen = new Reference(); // cc
2245      return this.specimen;
2246    }
2247
2248    public boolean hasSpecimen() { 
2249      return this.specimen != null && !this.specimen.isEmpty();
2250    }
2251
2252    /**
2253     * @param value {@link #specimen} (The specimen that was used when this observation was made.)
2254     */
2255    public Observation setSpecimen(Reference value) { 
2256      this.specimen = value;
2257      return this;
2258    }
2259
2260    /**
2261     * @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.)
2262     */
2263    public Specimen getSpecimenTarget() { 
2264      if (this.specimenTarget == null)
2265        if (Configuration.errorOnAutoCreate())
2266          throw new Error("Attempt to auto-create Observation.specimen");
2267        else if (Configuration.doAutoCreate())
2268          this.specimenTarget = new Specimen(); // aa
2269      return this.specimenTarget;
2270    }
2271
2272    /**
2273     * @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.)
2274     */
2275    public Observation setSpecimenTarget(Specimen value) { 
2276      this.specimenTarget = value;
2277      return this;
2278    }
2279
2280    /**
2281     * @return {@link #device} (The device used to generate the observation data.)
2282     */
2283    public Reference getDevice() { 
2284      if (this.device == null)
2285        if (Configuration.errorOnAutoCreate())
2286          throw new Error("Attempt to auto-create Observation.device");
2287        else if (Configuration.doAutoCreate())
2288          this.device = new Reference(); // cc
2289      return this.device;
2290    }
2291
2292    public boolean hasDevice() { 
2293      return this.device != null && !this.device.isEmpty();
2294    }
2295
2296    /**
2297     * @param value {@link #device} (The device used to generate the observation data.)
2298     */
2299    public Observation setDevice(Reference value) { 
2300      this.device = value;
2301      return this;
2302    }
2303
2304    /**
2305     * @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.)
2306     */
2307    public Resource getDeviceTarget() { 
2308      return this.deviceTarget;
2309    }
2310
2311    /**
2312     * @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.)
2313     */
2314    public Observation setDeviceTarget(Resource value) { 
2315      this.deviceTarget = value;
2316      return this;
2317    }
2318
2319    /**
2320     * @return {@link #referenceRange} (Guidance on how to interpret the value by comparison to a normal or recommended range.)
2321     */
2322    public List<ObservationReferenceRangeComponent> getReferenceRange() { 
2323      if (this.referenceRange == null)
2324        this.referenceRange = new ArrayList<ObservationReferenceRangeComponent>();
2325      return this.referenceRange;
2326    }
2327
2328    public boolean hasReferenceRange() { 
2329      if (this.referenceRange == null)
2330        return false;
2331      for (ObservationReferenceRangeComponent item : this.referenceRange)
2332        if (!item.isEmpty())
2333          return true;
2334      return false;
2335    }
2336
2337    /**
2338     * @return {@link #referenceRange} (Guidance on how to interpret the value by comparison to a normal or recommended range.)
2339     */
2340    // syntactic sugar
2341    public ObservationReferenceRangeComponent addReferenceRange() { //3
2342      ObservationReferenceRangeComponent t = new ObservationReferenceRangeComponent();
2343      if (this.referenceRange == null)
2344        this.referenceRange = new ArrayList<ObservationReferenceRangeComponent>();
2345      this.referenceRange.add(t);
2346      return t;
2347    }
2348
2349    // syntactic sugar
2350    public Observation addReferenceRange(ObservationReferenceRangeComponent t) { //3
2351      if (t == null)
2352        return this;
2353      if (this.referenceRange == null)
2354        this.referenceRange = new ArrayList<ObservationReferenceRangeComponent>();
2355      this.referenceRange.add(t);
2356      return this;
2357    }
2358
2359    /**
2360     * @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.)
2361     */
2362    public List<ObservationRelatedComponent> getRelated() { 
2363      if (this.related == null)
2364        this.related = new ArrayList<ObservationRelatedComponent>();
2365      return this.related;
2366    }
2367
2368    public boolean hasRelated() { 
2369      if (this.related == null)
2370        return false;
2371      for (ObservationRelatedComponent item : this.related)
2372        if (!item.isEmpty())
2373          return true;
2374      return false;
2375    }
2376
2377    /**
2378     * @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.)
2379     */
2380    // syntactic sugar
2381    public ObservationRelatedComponent addRelated() { //3
2382      ObservationRelatedComponent t = new ObservationRelatedComponent();
2383      if (this.related == null)
2384        this.related = new ArrayList<ObservationRelatedComponent>();
2385      this.related.add(t);
2386      return t;
2387    }
2388
2389    // syntactic sugar
2390    public Observation addRelated(ObservationRelatedComponent t) { //3
2391      if (t == null)
2392        return this;
2393      if (this.related == null)
2394        this.related = new ArrayList<ObservationRelatedComponent>();
2395      this.related.add(t);
2396      return this;
2397    }
2398
2399    /**
2400     * @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.)
2401     */
2402    public List<ObservationComponentComponent> getComponent() { 
2403      if (this.component == null)
2404        this.component = new ArrayList<ObservationComponentComponent>();
2405      return this.component;
2406    }
2407
2408    public boolean hasComponent() { 
2409      if (this.component == null)
2410        return false;
2411      for (ObservationComponentComponent item : this.component)
2412        if (!item.isEmpty())
2413          return true;
2414      return false;
2415    }
2416
2417    /**
2418     * @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.)
2419     */
2420    // syntactic sugar
2421    public ObservationComponentComponent addComponent() { //3
2422      ObservationComponentComponent t = new ObservationComponentComponent();
2423      if (this.component == null)
2424        this.component = new ArrayList<ObservationComponentComponent>();
2425      this.component.add(t);
2426      return t;
2427    }
2428
2429    // syntactic sugar
2430    public Observation addComponent(ObservationComponentComponent t) { //3
2431      if (t == null)
2432        return this;
2433      if (this.component == null)
2434        this.component = new ArrayList<ObservationComponentComponent>();
2435      this.component.add(t);
2436      return this;
2437    }
2438
2439      protected void listChildren(List<Property> childrenList) {
2440        super.listChildren(childrenList);
2441        childrenList.add(new Property("identifier", "Identifier", "A unique identifier for the simple observation instance.", 0, java.lang.Integer.MAX_VALUE, identifier));
2442        childrenList.add(new Property("status", "code", "The status of the result value.", 0, java.lang.Integer.MAX_VALUE, status));
2443        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));
2444        childrenList.add(new Property("code", "CodeableConcept", "Describes what was observed. Sometimes this is called the observation \"name\".", 0, java.lang.Integer.MAX_VALUE, code));
2445        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));
2446        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));
2447        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));
2448        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));
2449        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));
2450        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));
2451        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));
2452        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));
2453        childrenList.add(new Property("comment", "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, comment));
2454        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));
2455        childrenList.add(new Property("method", "CodeableConcept", "Indicates the mechanism used to perform the observation.", 0, java.lang.Integer.MAX_VALUE, method));
2456        childrenList.add(new Property("specimen", "Reference(Specimen)", "The specimen that was used when this observation was made.", 0, java.lang.Integer.MAX_VALUE, specimen));
2457        childrenList.add(new Property("device", "Reference(Device|DeviceMetric)", "The device used to generate the observation data.", 0, java.lang.Integer.MAX_VALUE, device));
2458        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));
2459        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));
2460        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));
2461      }
2462
2463      @Override
2464      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2465        switch (hash) {
2466        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
2467        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<ObservationStatus>
2468        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
2469        case 3059181: /*code*/ return this.code == null ? new Base[0] : new Base[] {this.code}; // CodeableConcept
2470        case -1867885268: /*subject*/ return this.subject == null ? new Base[0] : new Base[] {this.subject}; // Reference
2471        case 1524132147: /*encounter*/ return this.encounter == null ? new Base[0] : new Base[] {this.encounter}; // Reference
2472        case -1468651097: /*effective*/ return this.effective == null ? new Base[0] : new Base[] {this.effective}; // Type
2473        case -1179159893: /*issued*/ return this.issued == null ? new Base[0] : new Base[] {this.issued}; // InstantType
2474        case 481140686: /*performer*/ return this.performer == null ? new Base[0] : this.performer.toArray(new Base[this.performer.size()]); // Reference
2475        case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // Type
2476        case 1034315687: /*dataAbsentReason*/ return this.dataAbsentReason == null ? new Base[0] : new Base[] {this.dataAbsentReason}; // CodeableConcept
2477        case -297950712: /*interpretation*/ return this.interpretation == null ? new Base[0] : new Base[] {this.interpretation}; // CodeableConcept
2478        case 950398559: /*comment*/ return this.comment == null ? new Base[0] : new Base[] {this.comment}; // StringType
2479        case 1702620169: /*bodySite*/ return this.bodySite == null ? new Base[0] : new Base[] {this.bodySite}; // CodeableConcept
2480        case -1077554975: /*method*/ return this.method == null ? new Base[0] : new Base[] {this.method}; // CodeableConcept
2481        case -2132868344: /*specimen*/ return this.specimen == null ? new Base[0] : new Base[] {this.specimen}; // Reference
2482        case -1335157162: /*device*/ return this.device == null ? new Base[0] : new Base[] {this.device}; // Reference
2483        case -1912545102: /*referenceRange*/ return this.referenceRange == null ? new Base[0] : this.referenceRange.toArray(new Base[this.referenceRange.size()]); // ObservationReferenceRangeComponent
2484        case 1090493483: /*related*/ return this.related == null ? new Base[0] : this.related.toArray(new Base[this.related.size()]); // ObservationRelatedComponent
2485        case -1399907075: /*component*/ return this.component == null ? new Base[0] : this.component.toArray(new Base[this.component.size()]); // ObservationComponentComponent
2486        default: return super.getProperty(hash, name, checkValid);
2487        }
2488
2489      }
2490
2491      @Override
2492      public void setProperty(int hash, String name, Base value) throws FHIRException {
2493        switch (hash) {
2494        case -1618432855: // identifier
2495          this.getIdentifier().add(castToIdentifier(value)); // Identifier
2496          break;
2497        case -892481550: // status
2498          this.status = new ObservationStatusEnumFactory().fromType(value); // Enumeration<ObservationStatus>
2499          break;
2500        case 50511102: // category
2501          this.category = castToCodeableConcept(value); // CodeableConcept
2502          break;
2503        case 3059181: // code
2504          this.code = castToCodeableConcept(value); // CodeableConcept
2505          break;
2506        case -1867885268: // subject
2507          this.subject = castToReference(value); // Reference
2508          break;
2509        case 1524132147: // encounter
2510          this.encounter = castToReference(value); // Reference
2511          break;
2512        case -1468651097: // effective
2513          this.effective = (Type) value; // Type
2514          break;
2515        case -1179159893: // issued
2516          this.issued = castToInstant(value); // InstantType
2517          break;
2518        case 481140686: // performer
2519          this.getPerformer().add(castToReference(value)); // Reference
2520          break;
2521        case 111972721: // value
2522          this.value = (Type) value; // Type
2523          break;
2524        case 1034315687: // dataAbsentReason
2525          this.dataAbsentReason = castToCodeableConcept(value); // CodeableConcept
2526          break;
2527        case -297950712: // interpretation
2528          this.interpretation = castToCodeableConcept(value); // CodeableConcept
2529          break;
2530        case 950398559: // comment
2531          this.comment = castToString(value); // StringType
2532          break;
2533        case 1702620169: // bodySite
2534          this.bodySite = castToCodeableConcept(value); // CodeableConcept
2535          break;
2536        case -1077554975: // method
2537          this.method = castToCodeableConcept(value); // CodeableConcept
2538          break;
2539        case -2132868344: // specimen
2540          this.specimen = castToReference(value); // Reference
2541          break;
2542        case -1335157162: // device
2543          this.device = castToReference(value); // Reference
2544          break;
2545        case -1912545102: // referenceRange
2546          this.getReferenceRange().add((ObservationReferenceRangeComponent) value); // ObservationReferenceRangeComponent
2547          break;
2548        case 1090493483: // related
2549          this.getRelated().add((ObservationRelatedComponent) value); // ObservationRelatedComponent
2550          break;
2551        case -1399907075: // component
2552          this.getComponent().add((ObservationComponentComponent) value); // ObservationComponentComponent
2553          break;
2554        default: super.setProperty(hash, name, value);
2555        }
2556
2557      }
2558
2559      @Override
2560      public void setProperty(String name, Base value) throws FHIRException {
2561        if (name.equals("identifier"))
2562          this.getIdentifier().add(castToIdentifier(value));
2563        else if (name.equals("status"))
2564          this.status = new ObservationStatusEnumFactory().fromType(value); // Enumeration<ObservationStatus>
2565        else if (name.equals("category"))
2566          this.category = castToCodeableConcept(value); // CodeableConcept
2567        else if (name.equals("code"))
2568          this.code = castToCodeableConcept(value); // CodeableConcept
2569        else if (name.equals("subject"))
2570          this.subject = castToReference(value); // Reference
2571        else if (name.equals("encounter"))
2572          this.encounter = castToReference(value); // Reference
2573        else if (name.equals("effective[x]"))
2574          this.effective = (Type) value; // Type
2575        else if (name.equals("issued"))
2576          this.issued = castToInstant(value); // InstantType
2577        else if (name.equals("performer"))
2578          this.getPerformer().add(castToReference(value));
2579        else if (name.equals("value[x]"))
2580          this.value = (Type) value; // Type
2581        else if (name.equals("dataAbsentReason"))
2582          this.dataAbsentReason = castToCodeableConcept(value); // CodeableConcept
2583        else if (name.equals("interpretation"))
2584          this.interpretation = castToCodeableConcept(value); // CodeableConcept
2585        else if (name.equals("comment"))
2586          this.comment = castToString(value); // StringType
2587        else if (name.equals("bodySite"))
2588          this.bodySite = castToCodeableConcept(value); // CodeableConcept
2589        else if (name.equals("method"))
2590          this.method = castToCodeableConcept(value); // CodeableConcept
2591        else if (name.equals("specimen"))
2592          this.specimen = castToReference(value); // Reference
2593        else if (name.equals("device"))
2594          this.device = castToReference(value); // Reference
2595        else if (name.equals("referenceRange"))
2596          this.getReferenceRange().add((ObservationReferenceRangeComponent) value);
2597        else if (name.equals("related"))
2598          this.getRelated().add((ObservationRelatedComponent) value);
2599        else if (name.equals("component"))
2600          this.getComponent().add((ObservationComponentComponent) value);
2601        else
2602          super.setProperty(name, value);
2603      }
2604
2605      @Override
2606      public Base makeProperty(int hash, String name) throws FHIRException {
2607        switch (hash) {
2608        case -1618432855:  return addIdentifier(); // Identifier
2609        case -892481550: throw new FHIRException("Cannot make property status as it is not a complex type"); // Enumeration<ObservationStatus>
2610        case 50511102:  return getCategory(); // CodeableConcept
2611        case 3059181:  return getCode(); // CodeableConcept
2612        case -1867885268:  return getSubject(); // Reference
2613        case 1524132147:  return getEncounter(); // Reference
2614        case 247104889:  return getEffective(); // Type
2615        case -1179159893: throw new FHIRException("Cannot make property issued as it is not a complex type"); // InstantType
2616        case 481140686:  return addPerformer(); // Reference
2617        case -1410166417:  return getValue(); // Type
2618        case 1034315687:  return getDataAbsentReason(); // CodeableConcept
2619        case -297950712:  return getInterpretation(); // CodeableConcept
2620        case 950398559: throw new FHIRException("Cannot make property comment as it is not a complex type"); // StringType
2621        case 1702620169:  return getBodySite(); // CodeableConcept
2622        case -1077554975:  return getMethod(); // CodeableConcept
2623        case -2132868344:  return getSpecimen(); // Reference
2624        case -1335157162:  return getDevice(); // Reference
2625        case -1912545102:  return addReferenceRange(); // ObservationReferenceRangeComponent
2626        case 1090493483:  return addRelated(); // ObservationRelatedComponent
2627        case -1399907075:  return addComponent(); // ObservationComponentComponent
2628        default: return super.makeProperty(hash, name);
2629        }
2630
2631      }
2632
2633      @Override
2634      public Base addChild(String name) throws FHIRException {
2635        if (name.equals("identifier")) {
2636          return addIdentifier();
2637        }
2638        else if (name.equals("status")) {
2639          throw new FHIRException("Cannot call addChild on a primitive type Observation.status");
2640        }
2641        else if (name.equals("category")) {
2642          this.category = new CodeableConcept();
2643          return this.category;
2644        }
2645        else if (name.equals("code")) {
2646          this.code = new CodeableConcept();
2647          return this.code;
2648        }
2649        else if (name.equals("subject")) {
2650          this.subject = new Reference();
2651          return this.subject;
2652        }
2653        else if (name.equals("encounter")) {
2654          this.encounter = new Reference();
2655          return this.encounter;
2656        }
2657        else if (name.equals("effectiveDateTime")) {
2658          this.effective = new DateTimeType();
2659          return this.effective;
2660        }
2661        else if (name.equals("effectivePeriod")) {
2662          this.effective = new Period();
2663          return this.effective;
2664        }
2665        else if (name.equals("issued")) {
2666          throw new FHIRException("Cannot call addChild on a primitive type Observation.issued");
2667        }
2668        else if (name.equals("performer")) {
2669          return addPerformer();
2670        }
2671        else if (name.equals("valueQuantity")) {
2672          this.value = new Quantity();
2673          return this.value;
2674        }
2675        else if (name.equals("valueCodeableConcept")) {
2676          this.value = new CodeableConcept();
2677          return this.value;
2678        }
2679        else if (name.equals("valueString")) {
2680          this.value = new StringType();
2681          return this.value;
2682        }
2683        else if (name.equals("valueRange")) {
2684          this.value = new Range();
2685          return this.value;
2686        }
2687        else if (name.equals("valueRatio")) {
2688          this.value = new Ratio();
2689          return this.value;
2690        }
2691        else if (name.equals("valueSampledData")) {
2692          this.value = new SampledData();
2693          return this.value;
2694        }
2695        else if (name.equals("valueAttachment")) {
2696          this.value = new Attachment();
2697          return this.value;
2698        }
2699        else if (name.equals("valueTime")) {
2700          this.value = new TimeType();
2701          return this.value;
2702        }
2703        else if (name.equals("valueDateTime")) {
2704          this.value = new DateTimeType();
2705          return this.value;
2706        }
2707        else if (name.equals("valuePeriod")) {
2708          this.value = new Period();
2709          return this.value;
2710        }
2711        else if (name.equals("dataAbsentReason")) {
2712          this.dataAbsentReason = new CodeableConcept();
2713          return this.dataAbsentReason;
2714        }
2715        else if (name.equals("interpretation")) {
2716          this.interpretation = new CodeableConcept();
2717          return this.interpretation;
2718        }
2719        else if (name.equals("comment")) {
2720          throw new FHIRException("Cannot call addChild on a primitive type Observation.comment");
2721        }
2722        else if (name.equals("bodySite")) {
2723          this.bodySite = new CodeableConcept();
2724          return this.bodySite;
2725        }
2726        else if (name.equals("method")) {
2727          this.method = new CodeableConcept();
2728          return this.method;
2729        }
2730        else if (name.equals("specimen")) {
2731          this.specimen = new Reference();
2732          return this.specimen;
2733        }
2734        else if (name.equals("device")) {
2735          this.device = new Reference();
2736          return this.device;
2737        }
2738        else if (name.equals("referenceRange")) {
2739          return addReferenceRange();
2740        }
2741        else if (name.equals("related")) {
2742          return addRelated();
2743        }
2744        else if (name.equals("component")) {
2745          return addComponent();
2746        }
2747        else
2748          return super.addChild(name);
2749      }
2750
2751  public String fhirType() {
2752    return "Observation";
2753
2754  }
2755
2756      public Observation copy() {
2757        Observation dst = new Observation();
2758        copyValues(dst);
2759        if (identifier != null) {
2760          dst.identifier = new ArrayList<Identifier>();
2761          for (Identifier i : identifier)
2762            dst.identifier.add(i.copy());
2763        };
2764        dst.status = status == null ? null : status.copy();
2765        dst.category = category == null ? null : category.copy();
2766        dst.code = code == null ? null : code.copy();
2767        dst.subject = subject == null ? null : subject.copy();
2768        dst.encounter = encounter == null ? null : encounter.copy();
2769        dst.effective = effective == null ? null : effective.copy();
2770        dst.issued = issued == null ? null : issued.copy();
2771        if (performer != null) {
2772          dst.performer = new ArrayList<Reference>();
2773          for (Reference i : performer)
2774            dst.performer.add(i.copy());
2775        };
2776        dst.value = value == null ? null : value.copy();
2777        dst.dataAbsentReason = dataAbsentReason == null ? null : dataAbsentReason.copy();
2778        dst.interpretation = interpretation == null ? null : interpretation.copy();
2779        dst.comment = comment == null ? null : comment.copy();
2780        dst.bodySite = bodySite == null ? null : bodySite.copy();
2781        dst.method = method == null ? null : method.copy();
2782        dst.specimen = specimen == null ? null : specimen.copy();
2783        dst.device = device == null ? null : device.copy();
2784        if (referenceRange != null) {
2785          dst.referenceRange = new ArrayList<ObservationReferenceRangeComponent>();
2786          for (ObservationReferenceRangeComponent i : referenceRange)
2787            dst.referenceRange.add(i.copy());
2788        };
2789        if (related != null) {
2790          dst.related = new ArrayList<ObservationRelatedComponent>();
2791          for (ObservationRelatedComponent i : related)
2792            dst.related.add(i.copy());
2793        };
2794        if (component != null) {
2795          dst.component = new ArrayList<ObservationComponentComponent>();
2796          for (ObservationComponentComponent i : component)
2797            dst.component.add(i.copy());
2798        };
2799        return dst;
2800      }
2801
2802      protected Observation typedCopy() {
2803        return copy();
2804      }
2805
2806      @Override
2807      public boolean equalsDeep(Base other) {
2808        if (!super.equalsDeep(other))
2809          return false;
2810        if (!(other instanceof Observation))
2811          return false;
2812        Observation o = (Observation) other;
2813        return compareDeep(identifier, o.identifier, true) && compareDeep(status, o.status, true) && compareDeep(category, o.category, true)
2814           && compareDeep(code, o.code, true) && compareDeep(subject, o.subject, true) && compareDeep(encounter, o.encounter, true)
2815           && compareDeep(effective, o.effective, true) && compareDeep(issued, o.issued, true) && compareDeep(performer, o.performer, true)
2816           && compareDeep(value, o.value, true) && compareDeep(dataAbsentReason, o.dataAbsentReason, true)
2817           && compareDeep(interpretation, o.interpretation, true) && compareDeep(comment, o.comment, true)
2818           && compareDeep(bodySite, o.bodySite, true) && compareDeep(method, o.method, true) && compareDeep(specimen, o.specimen, true)
2819           && compareDeep(device, o.device, true) && compareDeep(referenceRange, o.referenceRange, true) && compareDeep(related, o.related, true)
2820           && compareDeep(component, o.component, true);
2821      }
2822
2823      @Override
2824      public boolean equalsShallow(Base other) {
2825        if (!super.equalsShallow(other))
2826          return false;
2827        if (!(other instanceof Observation))
2828          return false;
2829        Observation o = (Observation) other;
2830        return compareValues(status, o.status, true) && compareValues(issued, o.issued, true) && compareValues(comment, o.comment, true)
2831          ;
2832      }
2833
2834      public boolean isEmpty() {
2835        return super.isEmpty() && (identifier == null || identifier.isEmpty()) && (status == null || status.isEmpty())
2836           && (category == null || category.isEmpty()) && (code == null || code.isEmpty()) && (subject == null || subject.isEmpty())
2837           && (encounter == null || encounter.isEmpty()) && (effective == null || effective.isEmpty())
2838           && (issued == null || issued.isEmpty()) && (performer == null || performer.isEmpty()) && (value == null || value.isEmpty())
2839           && (dataAbsentReason == null || dataAbsentReason.isEmpty()) && (interpretation == null || interpretation.isEmpty())
2840           && (comment == null || comment.isEmpty()) && (bodySite == null || bodySite.isEmpty()) && (method == null || method.isEmpty())
2841           && (specimen == null || specimen.isEmpty()) && (device == null || device.isEmpty()) && (referenceRange == null || referenceRange.isEmpty())
2842           && (related == null || related.isEmpty()) && (component == null || component.isEmpty());
2843      }
2844
2845  @Override
2846  public ResourceType getResourceType() {
2847    return ResourceType.Observation;
2848   }
2849
2850 /**
2851   * Search parameter: <b>subject</b>
2852   * <p>
2853   * Description: <b>The subject that the observation is about</b><br>
2854   * Type: <b>reference</b><br>
2855   * Path: <b>Observation.subject</b><br>
2856   * </p>
2857   */
2858  @SearchParamDefinition(name="subject", path="Observation.subject", description="The subject that the observation is about", type="reference" )
2859  public static final String SP_SUBJECT = "subject";
2860 /**
2861   * <b>Fluent Client</b> search parameter constant for <b>subject</b>
2862   * <p>
2863   * Description: <b>The subject that the observation is about</b><br>
2864   * Type: <b>reference</b><br>
2865   * Path: <b>Observation.subject</b><br>
2866   * </p>
2867   */
2868  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBJECT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SUBJECT);
2869
2870/**
2871   * Constant for fluent queries to be used to add include statements. Specifies
2872   * the path value of "<b>Observation:subject</b>".
2873   */
2874  public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBJECT = new ca.uhn.fhir.model.api.Include("Observation:subject").toLocked();
2875
2876 /**
2877   * Search parameter: <b>encounter</b>
2878   * <p>
2879   * Description: <b>Healthcare event related to the observation</b><br>
2880   * Type: <b>reference</b><br>
2881   * Path: <b>Observation.encounter</b><br>
2882   * </p>
2883   */
2884  @SearchParamDefinition(name="encounter", path="Observation.encounter", description="Healthcare event related to the observation", type="reference" )
2885  public static final String SP_ENCOUNTER = "encounter";
2886 /**
2887   * <b>Fluent Client</b> search parameter constant for <b>encounter</b>
2888   * <p>
2889   * Description: <b>Healthcare event related to the observation</b><br>
2890   * Type: <b>reference</b><br>
2891   * Path: <b>Observation.encounter</b><br>
2892   * </p>
2893   */
2894  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ENCOUNTER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ENCOUNTER);
2895
2896/**
2897   * Constant for fluent queries to be used to add include statements. Specifies
2898   * the path value of "<b>Observation:encounter</b>".
2899   */
2900  public static final ca.uhn.fhir.model.api.Include INCLUDE_ENCOUNTER = new ca.uhn.fhir.model.api.Include("Observation:encounter").toLocked();
2901
2902 /**
2903   * Search parameter: <b>date</b>
2904   * <p>
2905   * Description: <b>Obtained date/time. If the obtained element is a period, a date that falls in the period</b><br>
2906   * Type: <b>date</b><br>
2907   * Path: <b>Observation.effective[x]</b><br>
2908   * </p>
2909   */
2910  @SearchParamDefinition(name="date", path="Observation.effective", description="Obtained date/time. If the obtained element is a period, a date that falls in the period", type="date" )
2911  public static final String SP_DATE = "date";
2912 /**
2913   * <b>Fluent Client</b> search parameter constant for <b>date</b>
2914   * <p>
2915   * Description: <b>Obtained date/time. If the obtained element is a period, a date that falls in the period</b><br>
2916   * Type: <b>date</b><br>
2917   * Path: <b>Observation.effective[x]</b><br>
2918   * </p>
2919   */
2920  public static final ca.uhn.fhir.rest.gclient.DateClientParam DATE = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_DATE);
2921
2922 /**
2923   * Search parameter: <b>component-value-quantity</b>
2924   * <p>
2925   * Description: <b>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)</b><br>
2926   * Type: <b>quantity</b><br>
2927   * Path: <b>Observation.component.valueQuantity</b><br>
2928   * </p>
2929   */
2930  @SearchParamDefinition(name="component-value-quantity", path="Observation.component.value.as(Quantity)", 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" )
2931  public static final String SP_COMPONENT_VALUE_QUANTITY = "component-value-quantity";
2932 /**
2933   * <b>Fluent Client</b> search parameter constant for <b>component-value-quantity</b>
2934   * <p>
2935   * Description: <b>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)</b><br>
2936   * Type: <b>quantity</b><br>
2937   * Path: <b>Observation.component.valueQuantity</b><br>
2938   * </p>
2939   */
2940  public static final ca.uhn.fhir.rest.gclient.QuantityClientParam COMPONENT_VALUE_QUANTITY = new ca.uhn.fhir.rest.gclient.QuantityClientParam(SP_COMPONENT_VALUE_QUANTITY);
2941
2942 /**
2943   * Search parameter: <b>related</b>
2944   * <p>
2945   * Description: <b>Related Observations - search on related-type and related-target together</b><br>
2946   * Type: <b>composite</b><br>
2947   * Path: <b></b><br>
2948   * </p>
2949   */
2950  @SearchParamDefinition(name="related", path="", description="Related Observations - search on related-type and related-target together", type="composite", compositeOf={"related-target", "related-type"} )
2951  public static final String SP_RELATED = "related";
2952 /**
2953   * <b>Fluent Client</b> search parameter constant for <b>related</b>
2954   * <p>
2955   * Description: <b>Related Observations - search on related-type and related-target together</b><br>
2956   * Type: <b>composite</b><br>
2957   * Path: <b></b><br>
2958   * </p>
2959   */
2960  public static final ca.uhn.fhir.rest.gclient.CompositeClientParam<ca.uhn.fhir.rest.gclient.ReferenceClientParam, ca.uhn.fhir.rest.gclient.TokenClientParam> RELATED = new ca.uhn.fhir.rest.gclient.CompositeClientParam<ca.uhn.fhir.rest.gclient.ReferenceClientParam, ca.uhn.fhir.rest.gclient.TokenClientParam>(SP_RELATED);
2961
2962 /**
2963   * Search parameter: <b>patient</b>
2964   * <p>
2965   * Description: <b>The subject that the observation is about (if patient)</b><br>
2966   * Type: <b>reference</b><br>
2967   * Path: <b>Observation.subject</b><br>
2968   * </p>
2969   */
2970  @SearchParamDefinition(name="patient", path="Observation.subject", description="The subject that the observation is about (if patient)", type="reference" )
2971  public static final String SP_PATIENT = "patient";
2972 /**
2973   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
2974   * <p>
2975   * Description: <b>The subject that the observation is about (if patient)</b><br>
2976   * Type: <b>reference</b><br>
2977   * Path: <b>Observation.subject</b><br>
2978   * </p>
2979   */
2980  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT);
2981
2982/**
2983   * Constant for fluent queries to be used to add include statements. Specifies
2984   * the path value of "<b>Observation:patient</b>".
2985   */
2986  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("Observation:patient").toLocked();
2987
2988 /**
2989   * Search parameter: <b>specimen</b>
2990   * <p>
2991   * Description: <b>Specimen used for this observation</b><br>
2992   * Type: <b>reference</b><br>
2993   * Path: <b>Observation.specimen</b><br>
2994   * </p>
2995   */
2996  @SearchParamDefinition(name="specimen", path="Observation.specimen", description="Specimen used for this observation", type="reference" )
2997  public static final String SP_SPECIMEN = "specimen";
2998 /**
2999   * <b>Fluent Client</b> search parameter constant for <b>specimen</b>
3000   * <p>
3001   * Description: <b>Specimen used for this observation</b><br>
3002   * Type: <b>reference</b><br>
3003   * Path: <b>Observation.specimen</b><br>
3004   * </p>
3005   */
3006  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SPECIMEN = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SPECIMEN);
3007
3008/**
3009   * Constant for fluent queries to be used to add include statements. Specifies
3010   * the path value of "<b>Observation:specimen</b>".
3011   */
3012  public static final ca.uhn.fhir.model.api.Include INCLUDE_SPECIMEN = new ca.uhn.fhir.model.api.Include("Observation:specimen").toLocked();
3013
3014 /**
3015   * Search parameter: <b>component-value-concept</b>
3016   * <p>
3017   * Description: <b>The value of the component observation, if the value is a CodeableConcept</b><br>
3018   * Type: <b>token</b><br>
3019   * Path: <b>Observation.component.valueCodeableConcept</b><br>
3020   * </p>
3021   */
3022  @SearchParamDefinition(name="component-value-concept", path="Observation.component.value.as(CodeableConcept)", description="The value of the component observation, if the value is a CodeableConcept", type="token" )
3023  public static final String SP_COMPONENT_VALUE_CONCEPT = "component-value-concept";
3024 /**
3025   * <b>Fluent Client</b> search parameter constant for <b>component-value-concept</b>
3026   * <p>
3027   * Description: <b>The value of the component observation, if the value is a CodeableConcept</b><br>
3028   * Type: <b>token</b><br>
3029   * Path: <b>Observation.component.valueCodeableConcept</b><br>
3030   * </p>
3031   */
3032  public static final ca.uhn.fhir.rest.gclient.TokenClientParam COMPONENT_VALUE_CONCEPT = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_COMPONENT_VALUE_CONCEPT);
3033
3034 /**
3035   * Search parameter: <b>component-code-value-quantity</b>
3036   * <p>
3037   * Description: <b>Both component code and one of the component value parameters</b><br>
3038   * Type: <b>composite</b><br>
3039   * Path: <b></b><br>
3040   * </p>
3041   */
3042  @SearchParamDefinition(name="component-code-value-quantity", path="", description="Both component code and one of the component value parameters", type="composite", compositeOf={"component-code", "value-quantity"} )
3043  public static final String SP_COMPONENT_CODE_VALUE_QUANTITY = "component-code-value-quantity";
3044 /**
3045   * <b>Fluent Client</b> search parameter constant for <b>component-code-value-quantity</b>
3046   * <p>
3047   * Description: <b>Both component code and one of the component value parameters</b><br>
3048   * Type: <b>composite</b><br>
3049   * Path: <b></b><br>
3050   * </p>
3051   */
3052  public static final ca.uhn.fhir.rest.gclient.CompositeClientParam<ca.uhn.fhir.rest.gclient.TokenClientParam, ca.uhn.fhir.rest.gclient.QuantityClientParam> COMPONENT_CODE_VALUE_QUANTITY = new ca.uhn.fhir.rest.gclient.CompositeClientParam<ca.uhn.fhir.rest.gclient.TokenClientParam, ca.uhn.fhir.rest.gclient.QuantityClientParam>(SP_COMPONENT_CODE_VALUE_QUANTITY);
3053
3054 /**
3055   * Search parameter: <b>component-code-value-date</b>
3056   * <p>
3057   * Description: <b>Both component code and one of the component value parameters</b><br>
3058   * Type: <b>composite</b><br>
3059   * Path: <b></b><br>
3060   * </p>
3061   */
3062  @SearchParamDefinition(name="component-code-value-date", path="", description="Both component code and one of the component value parameters", type="composite", compositeOf={"component-code", "value-date"} )
3063  public static final String SP_COMPONENT_CODE_VALUE_DATE = "component-code-value-date";
3064 /**
3065   * <b>Fluent Client</b> search parameter constant for <b>component-code-value-date</b>
3066   * <p>
3067   * Description: <b>Both component code and one of the component value parameters</b><br>
3068   * Type: <b>composite</b><br>
3069   * Path: <b></b><br>
3070   * </p>
3071   */
3072  public static final ca.uhn.fhir.rest.gclient.CompositeClientParam<ca.uhn.fhir.rest.gclient.TokenClientParam, ca.uhn.fhir.rest.gclient.DateClientParam> COMPONENT_CODE_VALUE_DATE = new ca.uhn.fhir.rest.gclient.CompositeClientParam<ca.uhn.fhir.rest.gclient.TokenClientParam, ca.uhn.fhir.rest.gclient.DateClientParam>(SP_COMPONENT_CODE_VALUE_DATE);
3073
3074 /**
3075   * Search parameter: <b>component-code-value-string</b>
3076   * <p>
3077   * Description: <b>Both component code and one of the component value parameters</b><br>
3078   * Type: <b>composite</b><br>
3079   * Path: <b></b><br>
3080   * </p>
3081   */
3082  @SearchParamDefinition(name="component-code-value-string", path="", description="Both component code and one of the component value parameters", type="composite", compositeOf={"component-code", "value-string"} )
3083  public static final String SP_COMPONENT_CODE_VALUE_STRING = "component-code-value-string";
3084 /**
3085   * <b>Fluent Client</b> search parameter constant for <b>component-code-value-string</b>
3086   * <p>
3087   * Description: <b>Both component code and one of the component value parameters</b><br>
3088   * Type: <b>composite</b><br>
3089   * Path: <b></b><br>
3090   * </p>
3091   */
3092  public static final ca.uhn.fhir.rest.gclient.CompositeClientParam<ca.uhn.fhir.rest.gclient.TokenClientParam, ca.uhn.fhir.rest.gclient.StringClientParam> COMPONENT_CODE_VALUE_STRING = new ca.uhn.fhir.rest.gclient.CompositeClientParam<ca.uhn.fhir.rest.gclient.TokenClientParam, ca.uhn.fhir.rest.gclient.StringClientParam>(SP_COMPONENT_CODE_VALUE_STRING);
3093
3094 /**
3095   * Search parameter: <b>component-code-value-concept</b>
3096   * <p>
3097   * Description: <b>Both component code and one of the component value parameters</b><br>
3098   * Type: <b>composite</b><br>
3099   * Path: <b></b><br>
3100   * </p>
3101   */
3102  @SearchParamDefinition(name="component-code-value-concept", path="", description="Both component code and one of the component value parameters", type="composite", compositeOf={"component-code", "value-concept"} )
3103  public static final String SP_COMPONENT_CODE_VALUE_CONCEPT = "component-code-value-concept";
3104 /**
3105   * <b>Fluent Client</b> search parameter constant for <b>component-code-value-concept</b>
3106   * <p>
3107   * Description: <b>Both component code and one of the component value parameters</b><br>
3108   * Type: <b>composite</b><br>
3109   * Path: <b></b><br>
3110   * </p>
3111   */
3112  public static final ca.uhn.fhir.rest.gclient.CompositeClientParam<ca.uhn.fhir.rest.gclient.TokenClientParam, ca.uhn.fhir.rest.gclient.TokenClientParam> COMPONENT_CODE_VALUE_CONCEPT = new ca.uhn.fhir.rest.gclient.CompositeClientParam<ca.uhn.fhir.rest.gclient.TokenClientParam, ca.uhn.fhir.rest.gclient.TokenClientParam>(SP_COMPONENT_CODE_VALUE_CONCEPT);
3113
3114 /**
3115   * Search parameter: <b>value-quantity</b>
3116   * <p>
3117   * Description: <b>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)</b><br>
3118   * Type: <b>quantity</b><br>
3119   * Path: <b>Observation.valueQuantity</b><br>
3120   * </p>
3121   */
3122  @SearchParamDefinition(name="value-quantity", path="Observation.value.as(Quantity)", 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" )
3123  public static final String SP_VALUE_QUANTITY = "value-quantity";
3124 /**
3125   * <b>Fluent Client</b> search parameter constant for <b>value-quantity</b>
3126   * <p>
3127   * Description: <b>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)</b><br>
3128   * Type: <b>quantity</b><br>
3129   * Path: <b>Observation.valueQuantity</b><br>
3130   * </p>
3131   */
3132  public static final ca.uhn.fhir.rest.gclient.QuantityClientParam VALUE_QUANTITY = new ca.uhn.fhir.rest.gclient.QuantityClientParam(SP_VALUE_QUANTITY);
3133
3134 /**
3135   * Search parameter: <b>value-date</b>
3136   * <p>
3137   * Description: <b>The value of the observation, if the value is a date or period of time</b><br>
3138   * Type: <b>date</b><br>
3139   * Path: <b>Observation.valueDateTime, Observation.valuePeriod</b><br>
3140   * </p>
3141   */
3142  @SearchParamDefinition(name="value-date", path="Observation.value.as(DateTime) | Observation.value.as(Period)", description="The value of the observation, if the value is a date or period of time", type="date" )
3143  public static final String SP_VALUE_DATE = "value-date";
3144 /**
3145   * <b>Fluent Client</b> search parameter constant for <b>value-date</b>
3146   * <p>
3147   * Description: <b>The value of the observation, if the value is a date or period of time</b><br>
3148   * Type: <b>date</b><br>
3149   * Path: <b>Observation.valueDateTime, Observation.valuePeriod</b><br>
3150   * </p>
3151   */
3152  public static final ca.uhn.fhir.rest.gclient.DateClientParam VALUE_DATE = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_VALUE_DATE);
3153
3154 /**
3155   * Search parameter: <b>value-string</b>
3156   * <p>
3157   * Description: <b>The value of the observation, if the value is a string, and also searches in CodeableConcept.text</b><br>
3158   * Type: <b>string</b><br>
3159   * Path: <b>Observation.valueString</b><br>
3160   * </p>
3161   */
3162  @SearchParamDefinition(name="value-string", path="Observation.value.as(String)", description="The value of the observation, if the value is a string, and also searches in CodeableConcept.text", type="string" )
3163  public static final String SP_VALUE_STRING = "value-string";
3164 /**
3165   * <b>Fluent Client</b> search parameter constant for <b>value-string</b>
3166   * <p>
3167   * Description: <b>The value of the observation, if the value is a string, and also searches in CodeableConcept.text</b><br>
3168   * Type: <b>string</b><br>
3169   * Path: <b>Observation.valueString</b><br>
3170   * </p>
3171   */
3172  public static final ca.uhn.fhir.rest.gclient.StringClientParam VALUE_STRING = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_VALUE_STRING);
3173
3174 /**
3175   * Search parameter: <b>component-code</b>
3176   * <p>
3177   * Description: <b>The component code of the observation type</b><br>
3178   * Type: <b>token</b><br>
3179   * Path: <b>Observation.component.code</b><br>
3180   * </p>
3181   */
3182  @SearchParamDefinition(name="component-code", path="Observation.component.code", description="The component code of the observation type", type="token" )
3183  public static final String SP_COMPONENT_CODE = "component-code";
3184 /**
3185   * <b>Fluent Client</b> search parameter constant for <b>component-code</b>
3186   * <p>
3187   * Description: <b>The component code of the observation type</b><br>
3188   * Type: <b>token</b><br>
3189   * Path: <b>Observation.component.code</b><br>
3190   * </p>
3191   */
3192  public static final ca.uhn.fhir.rest.gclient.TokenClientParam COMPONENT_CODE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_COMPONENT_CODE);
3193
3194 /**
3195   * Search parameter: <b>status</b>
3196   * <p>
3197   * Description: <b>The status of the observation</b><br>
3198   * Type: <b>token</b><br>
3199   * Path: <b>Observation.status</b><br>
3200   * </p>
3201   */
3202  @SearchParamDefinition(name="status", path="Observation.status", description="The status of the observation", type="token" )
3203  public static final String SP_STATUS = "status";
3204 /**
3205   * <b>Fluent Client</b> search parameter constant for <b>status</b>
3206   * <p>
3207   * Description: <b>The status of the observation</b><br>
3208   * Type: <b>token</b><br>
3209   * Path: <b>Observation.status</b><br>
3210   * </p>
3211   */
3212  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS);
3213
3214 /**
3215   * Search parameter: <b>value-concept</b>
3216   * <p>
3217   * Description: <b>The value of the observation, if the value is a CodeableConcept</b><br>
3218   * Type: <b>token</b><br>
3219   * Path: <b>Observation.valueCodeableConcept</b><br>
3220   * </p>
3221   */
3222  @SearchParamDefinition(name="value-concept", path="Observation.value.as(CodeableConcept)", description="The value of the observation, if the value is a CodeableConcept", type="token" )
3223  public static final String SP_VALUE_CONCEPT = "value-concept";
3224 /**
3225   * <b>Fluent Client</b> search parameter constant for <b>value-concept</b>
3226   * <p>
3227   * Description: <b>The value of the observation, if the value is a CodeableConcept</b><br>
3228   * Type: <b>token</b><br>
3229   * Path: <b>Observation.valueCodeableConcept</b><br>
3230   * </p>
3231   */
3232  public static final ca.uhn.fhir.rest.gclient.TokenClientParam VALUE_CONCEPT = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_VALUE_CONCEPT);
3233
3234 /**
3235   * Search parameter: <b>code</b>
3236   * <p>
3237   * Description: <b>The code of the observation type</b><br>
3238   * Type: <b>token</b><br>
3239   * Path: <b>Observation.code</b><br>
3240   * </p>
3241   */
3242  @SearchParamDefinition(name="code", path="Observation.code", description="The code of the observation type", type="token" )
3243  public static final String SP_CODE = "code";
3244 /**
3245   * <b>Fluent Client</b> search parameter constant for <b>code</b>
3246   * <p>
3247   * Description: <b>The code of the observation type</b><br>
3248   * Type: <b>token</b><br>
3249   * Path: <b>Observation.code</b><br>
3250   * </p>
3251   */
3252  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CODE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CODE);
3253
3254 /**
3255   * Search parameter: <b>related-target</b>
3256   * <p>
3257   * Description: <b>Resource that is related to this one</b><br>
3258   * Type: <b>reference</b><br>
3259   * Path: <b>Observation.related.target</b><br>
3260   * </p>
3261   */
3262  @SearchParamDefinition(name="related-target", path="Observation.related.target", description="Resource that is related to this one", type="reference" )
3263  public static final String SP_RELATED_TARGET = "related-target";
3264 /**
3265   * <b>Fluent Client</b> search parameter constant for <b>related-target</b>
3266   * <p>
3267   * Description: <b>Resource that is related to this one</b><br>
3268   * Type: <b>reference</b><br>
3269   * Path: <b>Observation.related.target</b><br>
3270   * </p>
3271   */
3272  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam RELATED_TARGET = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_RELATED_TARGET);
3273
3274/**
3275   * Constant for fluent queries to be used to add include statements. Specifies
3276   * the path value of "<b>Observation:related-target</b>".
3277   */
3278  public static final ca.uhn.fhir.model.api.Include INCLUDE_RELATED_TARGET = new ca.uhn.fhir.model.api.Include("Observation:related-target").toLocked();
3279
3280 /**
3281   * Search parameter: <b>data-absent-reason</b>
3282   * <p>
3283   * Description: <b>The reason why the expected value in the element Observation.value[x] is missing.</b><br>
3284   * Type: <b>token</b><br>
3285   * Path: <b>Observation.dataAbsentReason</b><br>
3286   * </p>
3287   */
3288  @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" )
3289  public static final String SP_DATA_ABSENT_REASON = "data-absent-reason";
3290 /**
3291   * <b>Fluent Client</b> search parameter constant for <b>data-absent-reason</b>
3292   * <p>
3293   * Description: <b>The reason why the expected value in the element Observation.value[x] is missing.</b><br>
3294   * Type: <b>token</b><br>
3295   * Path: <b>Observation.dataAbsentReason</b><br>
3296   * </p>
3297   */
3298  public static final ca.uhn.fhir.rest.gclient.TokenClientParam DATA_ABSENT_REASON = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_DATA_ABSENT_REASON);
3299
3300 /**
3301   * Search parameter: <b>category</b>
3302   * <p>
3303   * Description: <b>The classification of the type of observation</b><br>
3304   * Type: <b>token</b><br>
3305   * Path: <b>Observation.category</b><br>
3306   * </p>
3307   */
3308  @SearchParamDefinition(name="category", path="Observation.category", description="The classification of the type of observation", type="token" )
3309  public static final String SP_CATEGORY = "category";
3310 /**
3311   * <b>Fluent Client</b> search parameter constant for <b>category</b>
3312   * <p>
3313   * Description: <b>The classification of the type of observation</b><br>
3314   * Type: <b>token</b><br>
3315   * Path: <b>Observation.category</b><br>
3316   * </p>
3317   */
3318  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CATEGORY = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CATEGORY);
3319
3320 /**
3321   * Search parameter: <b>component-data-absent-reason</b>
3322   * <p>
3323   * Description: <b>The reason why the expected value in the element Observation.component.value[x] is missing.</b><br>
3324   * Type: <b>token</b><br>
3325   * Path: <b>Observation.component.dataAbsentReason</b><br>
3326   * </p>
3327   */
3328  @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" )
3329  public static final String SP_COMPONENT_DATA_ABSENT_REASON = "component-data-absent-reason";
3330 /**
3331   * <b>Fluent Client</b> search parameter constant for <b>component-data-absent-reason</b>
3332   * <p>
3333   * Description: <b>The reason why the expected value in the element Observation.component.value[x] is missing.</b><br>
3334   * Type: <b>token</b><br>
3335   * Path: <b>Observation.component.dataAbsentReason</b><br>
3336   * </p>
3337   */
3338  public static final ca.uhn.fhir.rest.gclient.TokenClientParam COMPONENT_DATA_ABSENT_REASON = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_COMPONENT_DATA_ABSENT_REASON);
3339
3340 /**
3341   * Search parameter: <b>device</b>
3342   * <p>
3343   * Description: <b>The Device that generated the observation data.</b><br>
3344   * Type: <b>reference</b><br>
3345   * Path: <b>Observation.device</b><br>
3346   * </p>
3347   */
3348  @SearchParamDefinition(name="device", path="Observation.device", description="The Device that generated the observation data.", type="reference" )
3349  public static final String SP_DEVICE = "device";
3350 /**
3351   * <b>Fluent Client</b> search parameter constant for <b>device</b>
3352   * <p>
3353   * Description: <b>The Device that generated the observation data.</b><br>
3354   * Type: <b>reference</b><br>
3355   * Path: <b>Observation.device</b><br>
3356   * </p>
3357   */
3358  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam DEVICE = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_DEVICE);
3359
3360/**
3361   * Constant for fluent queries to be used to add include statements. Specifies
3362   * the path value of "<b>Observation:device</b>".
3363   */
3364  public static final ca.uhn.fhir.model.api.Include INCLUDE_DEVICE = new ca.uhn.fhir.model.api.Include("Observation:device").toLocked();
3365
3366 /**
3367   * Search parameter: <b>related-type</b>
3368   * <p>
3369   * Description: <b>has-member | derived-from | sequel-to | replaces | qualified-by | interfered-by</b><br>
3370   * Type: <b>token</b><br>
3371   * Path: <b>Observation.related.type</b><br>
3372   * </p>
3373   */
3374  @SearchParamDefinition(name="related-type", path="Observation.related.type", description="has-member | derived-from | sequel-to | replaces | qualified-by | interfered-by", type="token" )
3375  public static final String SP_RELATED_TYPE = "related-type";
3376 /**
3377   * <b>Fluent Client</b> search parameter constant for <b>related-type</b>
3378   * <p>
3379   * Description: <b>has-member | derived-from | sequel-to | replaces | qualified-by | interfered-by</b><br>
3380   * Type: <b>token</b><br>
3381   * Path: <b>Observation.related.type</b><br>
3382   * </p>
3383   */
3384  public static final ca.uhn.fhir.rest.gclient.TokenClientParam RELATED_TYPE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_RELATED_TYPE);
3385
3386 /**
3387   * Search parameter: <b>performer</b>
3388   * <p>
3389   * Description: <b>Who performed the observation</b><br>
3390   * Type: <b>reference</b><br>
3391   * Path: <b>Observation.performer</b><br>
3392   * </p>
3393   */
3394  @SearchParamDefinition(name="performer", path="Observation.performer", description="Who performed the observation", type="reference" )
3395  public static final String SP_PERFORMER = "performer";
3396 /**
3397   * <b>Fluent Client</b> search parameter constant for <b>performer</b>
3398   * <p>
3399   * Description: <b>Who performed the observation</b><br>
3400   * Type: <b>reference</b><br>
3401   * Path: <b>Observation.performer</b><br>
3402   * </p>
3403   */
3404  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PERFORMER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PERFORMER);
3405
3406/**
3407   * Constant for fluent queries to be used to add include statements. Specifies
3408   * the path value of "<b>Observation:performer</b>".
3409   */
3410  public static final ca.uhn.fhir.model.api.Include INCLUDE_PERFORMER = new ca.uhn.fhir.model.api.Include("Observation:performer").toLocked();
3411
3412 /**
3413   * Search parameter: <b>identifier</b>
3414   * <p>
3415   * Description: <b>The unique id for a particular observation</b><br>
3416   * Type: <b>token</b><br>
3417   * Path: <b>Observation.identifier</b><br>
3418   * </p>
3419   */
3420  @SearchParamDefinition(name="identifier", path="Observation.identifier", description="The unique id for a particular observation", type="token" )
3421  public static final String SP_IDENTIFIER = "identifier";
3422 /**
3423   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
3424   * <p>
3425   * Description: <b>The unique id for a particular observation</b><br>
3426   * Type: <b>token</b><br>
3427   * Path: <b>Observation.identifier</b><br>
3428   * </p>
3429   */
3430  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
3431
3432 /**
3433   * Search parameter: <b>code-value-quantity</b>
3434   * <p>
3435   * Description: <b>Both code and one of the value parameters</b><br>
3436   * Type: <b>composite</b><br>
3437   * Path: <b></b><br>
3438   * </p>
3439   */
3440  @SearchParamDefinition(name="code-value-quantity", path="", description="Both code and one of the value parameters", type="composite", compositeOf={"code", "value-quantity"} )
3441  public static final String SP_CODE_VALUE_QUANTITY = "code-value-quantity";
3442 /**
3443   * <b>Fluent Client</b> search parameter constant for <b>code-value-quantity</b>
3444   * <p>
3445   * Description: <b>Both code and one of the value parameters</b><br>
3446   * Type: <b>composite</b><br>
3447   * Path: <b></b><br>
3448   * </p>
3449   */
3450  public static final ca.uhn.fhir.rest.gclient.CompositeClientParam<ca.uhn.fhir.rest.gclient.TokenClientParam, ca.uhn.fhir.rest.gclient.QuantityClientParam> CODE_VALUE_QUANTITY = new ca.uhn.fhir.rest.gclient.CompositeClientParam<ca.uhn.fhir.rest.gclient.TokenClientParam, ca.uhn.fhir.rest.gclient.QuantityClientParam>(SP_CODE_VALUE_QUANTITY);
3451
3452 /**
3453   * Search parameter: <b>code-value-date</b>
3454   * <p>
3455   * Description: <b>Both code and one of the value parameters</b><br>
3456   * Type: <b>composite</b><br>
3457   * Path: <b></b><br>
3458   * </p>
3459   */
3460  @SearchParamDefinition(name="code-value-date", path="", description="Both code and one of the value parameters", type="composite", compositeOf={"code", "value-date"} )
3461  public static final String SP_CODE_VALUE_DATE = "code-value-date";
3462 /**
3463   * <b>Fluent Client</b> search parameter constant for <b>code-value-date</b>
3464   * <p>
3465   * Description: <b>Both code and one of the value parameters</b><br>
3466   * Type: <b>composite</b><br>
3467   * Path: <b></b><br>
3468   * </p>
3469   */
3470  public static final ca.uhn.fhir.rest.gclient.CompositeClientParam<ca.uhn.fhir.rest.gclient.TokenClientParam, ca.uhn.fhir.rest.gclient.DateClientParam> CODE_VALUE_DATE = new ca.uhn.fhir.rest.gclient.CompositeClientParam<ca.uhn.fhir.rest.gclient.TokenClientParam, ca.uhn.fhir.rest.gclient.DateClientParam>(SP_CODE_VALUE_DATE);
3471
3472 /**
3473   * Search parameter: <b>code-value-string</b>
3474   * <p>
3475   * Description: <b>Both code and one of the value parameters</b><br>
3476   * Type: <b>composite</b><br>
3477   * Path: <b></b><br>
3478   * </p>
3479   */
3480  @SearchParamDefinition(name="code-value-string", path="", description="Both code and one of the value parameters", type="composite", compositeOf={"code", "value-string"} )
3481  public static final String SP_CODE_VALUE_STRING = "code-value-string";
3482 /**
3483   * <b>Fluent Client</b> search parameter constant for <b>code-value-string</b>
3484   * <p>
3485   * Description: <b>Both code and one of the value parameters</b><br>
3486   * Type: <b>composite</b><br>
3487   * Path: <b></b><br>
3488   * </p>
3489   */
3490  public static final ca.uhn.fhir.rest.gclient.CompositeClientParam<ca.uhn.fhir.rest.gclient.TokenClientParam, ca.uhn.fhir.rest.gclient.StringClientParam> CODE_VALUE_STRING = new ca.uhn.fhir.rest.gclient.CompositeClientParam<ca.uhn.fhir.rest.gclient.TokenClientParam, ca.uhn.fhir.rest.gclient.StringClientParam>(SP_CODE_VALUE_STRING);
3491
3492 /**
3493   * Search parameter: <b>code-value-concept</b>
3494   * <p>
3495   * Description: <b>Both code and one of the value parameters</b><br>
3496   * Type: <b>composite</b><br>
3497   * Path: <b></b><br>
3498   * </p>
3499   */
3500  @SearchParamDefinition(name="code-value-concept", path="", description="Both code and one of the value parameters", type="composite", compositeOf={"code", "value-concept"} )
3501  public static final String SP_CODE_VALUE_CONCEPT = "code-value-concept";
3502 /**
3503   * <b>Fluent Client</b> search parameter constant for <b>code-value-concept</b>
3504   * <p>
3505   * Description: <b>Both code and one of the value parameters</b><br>
3506   * Type: <b>composite</b><br>
3507   * Path: <b></b><br>
3508   * </p>
3509   */
3510  public static final ca.uhn.fhir.rest.gclient.CompositeClientParam<ca.uhn.fhir.rest.gclient.TokenClientParam, ca.uhn.fhir.rest.gclient.TokenClientParam> CODE_VALUE_CONCEPT = new ca.uhn.fhir.rest.gclient.CompositeClientParam<ca.uhn.fhir.rest.gclient.TokenClientParam, ca.uhn.fhir.rest.gclient.TokenClientParam>(SP_CODE_VALUE_CONCEPT);
3511
3512 /**
3513   * Search parameter: <b>component-value-string</b>
3514   * <p>
3515   * Description: <b>The value of the component observation, if the value is a string, and also searches in CodeableConcept.text</b><br>
3516   * Type: <b>string</b><br>
3517   * Path: <b>Observation.component.valueString</b><br>
3518   * </p>
3519   */
3520  @SearchParamDefinition(name="component-value-string", path="Observation.component.value.as(String)", description="The value of the component observation, if the value is a string, and also searches in CodeableConcept.text", type="string" )
3521  public static final String SP_COMPONENT_VALUE_STRING = "component-value-string";
3522 /**
3523   * <b>Fluent Client</b> search parameter constant for <b>component-value-string</b>
3524   * <p>
3525   * Description: <b>The value of the component observation, if the value is a string, and also searches in CodeableConcept.text</b><br>
3526   * Type: <b>string</b><br>
3527   * Path: <b>Observation.component.valueString</b><br>
3528   * </p>
3529   */
3530  public static final ca.uhn.fhir.rest.gclient.StringClientParam COMPONENT_VALUE_STRING = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_COMPONENT_VALUE_STRING);
3531
3532
3533}