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