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