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