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