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