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