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