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