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