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