001package org.hl7.fhir.dstu2.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 Wed, Jul 13, 2016 05:32+1000 for FHIR v1.0.2
033import java.util.ArrayList;
034import java.util.Date;
035import java.util.List;
036
037import ca.uhn.fhir.model.api.annotation.Block;
038import ca.uhn.fhir.model.api.annotation.Child;
039import ca.uhn.fhir.model.api.annotation.Description;
040import ca.uhn.fhir.model.api.annotation.ResourceDef;
041import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
042import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
043import org.hl7.fhir.exceptions.FHIRException;
044import org.hl7.fhir.utilities.Utilities;
045
046/**
047 * Measurements and simple assertions made about a patient, device or other
048 * subject.
049 */
050@ResourceDef(name = "Observation", profile = "http://hl7.org/fhir/Profile/Observation")
051public class Observation extends DomainResource {
052
053  public enum ObservationStatus {
054    /**
055     * The existence of the observation is registered, but there is no result yet
056     * available.
057     */
058    REGISTERED,
059    /**
060     * This is an initial or interim observation: data may be incomplete or
061     * unverified.
062     */
063    PRELIMINARY,
064    /**
065     * The observation is complete and verified by an authorized person.
066     */
067    FINAL,
068    /**
069     * The observation has been modified subsequent to being Final, and is complete
070     * and verified by an authorized person.
071     */
072    AMENDED,
073    /**
074     * The observation is unavailable because the measurement was not started or not
075     * completed (also sometimes called "aborted").
076     */
077    CANCELLED,
078    /**
079     * The observation has been withdrawn following previous final release.
080     */
081    ENTEREDINERROR,
082    /**
083     * The observation status is unknown. Note that "unknown" is a value of last
084     * resort and every attempt should be made to provide a meaningful value other
085     * than "unknown".
086     */
087    UNKNOWN,
088    /**
089     * added to help the parsers
090     */
091    NULL;
092
093    public static ObservationStatus fromCode(String codeString) throws FHIRException {
094      if (codeString == null || "".equals(codeString))
095        return null;
096      if ("registered".equals(codeString))
097        return REGISTERED;
098      if ("preliminary".equals(codeString))
099        return PRELIMINARY;
100      if ("final".equals(codeString))
101        return FINAL;
102      if ("amended".equals(codeString))
103        return AMENDED;
104      if ("cancelled".equals(codeString))
105        return CANCELLED;
106      if ("entered-in-error".equals(codeString))
107        return ENTEREDINERROR;
108      if ("unknown".equals(codeString))
109        return UNKNOWN;
110      throw new FHIRException("Unknown ObservationStatus code '" + codeString + "'");
111    }
112
113    public String toCode() {
114      switch (this) {
115      case REGISTERED:
116        return "registered";
117      case PRELIMINARY:
118        return "preliminary";
119      case FINAL:
120        return "final";
121      case AMENDED:
122        return "amended";
123      case CANCELLED:
124        return "cancelled";
125      case ENTEREDINERROR:
126        return "entered-in-error";
127      case UNKNOWN:
128        return "unknown";
129      case NULL:
130        return null;
131      default:
132        return "?";
133      }
134    }
135
136    public String getSystem() {
137      switch (this) {
138      case REGISTERED:
139        return "http://hl7.org/fhir/observation-status";
140      case PRELIMINARY:
141        return "http://hl7.org/fhir/observation-status";
142      case FINAL:
143        return "http://hl7.org/fhir/observation-status";
144      case AMENDED:
145        return "http://hl7.org/fhir/observation-status";
146      case CANCELLED:
147        return "http://hl7.org/fhir/observation-status";
148      case ENTEREDINERROR:
149        return "http://hl7.org/fhir/observation-status";
150      case UNKNOWN:
151        return "http://hl7.org/fhir/observation-status";
152      case NULL:
153        return null;
154      default:
155        return "?";
156      }
157    }
158
159    public String getDefinition() {
160      switch (this) {
161      case REGISTERED:
162        return "The existence of the observation is registered, but there is no result yet available.";
163      case PRELIMINARY:
164        return "This is an initial or interim observation: data may be incomplete or unverified.";
165      case FINAL:
166        return "The observation is complete and verified by an authorized person.";
167      case AMENDED:
168        return "The observation has been modified subsequent to being Final, and is complete and verified by an authorized person.";
169      case CANCELLED:
170        return "The observation is unavailable because the measurement was not started or not completed (also sometimes called \"aborted\").";
171      case ENTEREDINERROR:
172        return "The observation has been withdrawn following previous final release.";
173      case UNKNOWN:
174        return "The observation status is unknown.  Note that \"unknown\" is a value of last resort and every attempt should be made to provide a meaningful value other than \"unknown\".";
175      case NULL:
176        return null;
177      default:
178        return "?";
179      }
180    }
181
182    public String getDisplay() {
183      switch (this) {
184      case REGISTERED:
185        return "Registered";
186      case PRELIMINARY:
187        return "Preliminary";
188      case FINAL:
189        return "Final";
190      case AMENDED:
191        return "Amended";
192      case CANCELLED:
193        return "cancelled";
194      case ENTEREDINERROR:
195        return "Entered in Error";
196      case UNKNOWN:
197        return "Unknown Status";
198      case NULL:
199        return null;
200      default:
201        return "?";
202      }
203    }
204  }
205
206  public static class ObservationStatusEnumFactory implements EnumFactory<ObservationStatus> {
207    public ObservationStatus fromCode(String codeString) throws IllegalArgumentException {
208      if (codeString == null || "".equals(codeString))
209        if (codeString == null || "".equals(codeString))
210          return null;
211      if ("registered".equals(codeString))
212        return ObservationStatus.REGISTERED;
213      if ("preliminary".equals(codeString))
214        return ObservationStatus.PRELIMINARY;
215      if ("final".equals(codeString))
216        return ObservationStatus.FINAL;
217      if ("amended".equals(codeString))
218        return ObservationStatus.AMENDED;
219      if ("cancelled".equals(codeString))
220        return ObservationStatus.CANCELLED;
221      if ("entered-in-error".equals(codeString))
222        return ObservationStatus.ENTEREDINERROR;
223      if ("unknown".equals(codeString))
224        return ObservationStatus.UNKNOWN;
225      throw new IllegalArgumentException("Unknown ObservationStatus code '" + codeString + "'");
226    }
227
228    public Enumeration<ObservationStatus> fromType(Base code) throws FHIRException {
229      if (code == null || code.isEmpty())
230        return null;
231      String codeString = ((PrimitiveType) code).asStringValue();
232      if (codeString == null || "".equals(codeString))
233        return null;
234      if ("registered".equals(codeString))
235        return new Enumeration<ObservationStatus>(this, ObservationStatus.REGISTERED);
236      if ("preliminary".equals(codeString))
237        return new Enumeration<ObservationStatus>(this, ObservationStatus.PRELIMINARY);
238      if ("final".equals(codeString))
239        return new Enumeration<ObservationStatus>(this, ObservationStatus.FINAL);
240      if ("amended".equals(codeString))
241        return new Enumeration<ObservationStatus>(this, ObservationStatus.AMENDED);
242      if ("cancelled".equals(codeString))
243        return new Enumeration<ObservationStatus>(this, ObservationStatus.CANCELLED);
244      if ("entered-in-error".equals(codeString))
245        return new Enumeration<ObservationStatus>(this, ObservationStatus.ENTEREDINERROR);
246      if ("unknown".equals(codeString))
247        return new Enumeration<ObservationStatus>(this, ObservationStatus.UNKNOWN);
248      throw new FHIRException("Unknown ObservationStatus code '" + codeString + "'");
249    }
250
251    public String toCode(ObservationStatus code) {
252      if (code == ObservationStatus.REGISTERED)
253        return "registered";
254      if (code == ObservationStatus.PRELIMINARY)
255        return "preliminary";
256      if (code == ObservationStatus.FINAL)
257        return "final";
258      if (code == ObservationStatus.AMENDED)
259        return "amended";
260      if (code == ObservationStatus.CANCELLED)
261        return "cancelled";
262      if (code == ObservationStatus.ENTEREDINERROR)
263        return "entered-in-error";
264      if (code == ObservationStatus.UNKNOWN)
265        return "unknown";
266      return "?";
267    }
268  }
269
270  public enum ObservationRelationshipType {
271    /**
272     * This observation is a group observation (e.g. a battery, a panel of tests, a
273     * set of vital sign measurements) that includes the target as a member of the
274     * group.
275     */
276    HASMEMBER,
277    /**
278     * The target resource (Observation or QuestionnaireResponse) is part of the
279     * information from which this observation value is derived. (e.g. calculated
280     * anion gap, Apgar score) NOTE: "derived-from" is only logical choice when
281     * referencing QuestionnaireResponse.
282     */
283    DERIVEDFROM,
284    /**
285     * This observation follows the target observation (e.g. timed tests such as
286     * Glucose Tolerance Test).
287     */
288    SEQUELTO,
289    /**
290     * This observation replaces a previous observation (i.e. a revised value). The
291     * target observation is now obsolete.
292     */
293    REPLACES,
294    /**
295     * The value of the target observation qualifies (refines) the semantics of the
296     * source observation (e.g. a lipemia measure target from a plasma measure).
297     */
298    QUALIFIEDBY,
299    /**
300     * The value of the target observation interferes (degrades quality, or prevents
301     * valid observation) with the semantics of the source observation (e.g. a
302     * hemolysis measure target from a plasma potassium measure which has no value).
303     */
304    INTERFEREDBY,
305    /**
306     * added to help the parsers
307     */
308    NULL;
309
310    public static ObservationRelationshipType fromCode(String codeString) throws FHIRException {
311      if (codeString == null || "".equals(codeString))
312        return null;
313      if ("has-member".equals(codeString))
314        return HASMEMBER;
315      if ("derived-from".equals(codeString))
316        return DERIVEDFROM;
317      if ("sequel-to".equals(codeString))
318        return SEQUELTO;
319      if ("replaces".equals(codeString))
320        return REPLACES;
321      if ("qualified-by".equals(codeString))
322        return QUALIFIEDBY;
323      if ("interfered-by".equals(codeString))
324        return INTERFEREDBY;
325      throw new FHIRException("Unknown ObservationRelationshipType code '" + codeString + "'");
326    }
327
328    public String toCode() {
329      switch (this) {
330      case HASMEMBER:
331        return "has-member";
332      case DERIVEDFROM:
333        return "derived-from";
334      case SEQUELTO:
335        return "sequel-to";
336      case REPLACES:
337        return "replaces";
338      case QUALIFIEDBY:
339        return "qualified-by";
340      case INTERFEREDBY:
341        return "interfered-by";
342      case NULL:
343        return null;
344      default:
345        return "?";
346      }
347    }
348
349    public String getSystem() {
350      switch (this) {
351      case HASMEMBER:
352        return "http://hl7.org/fhir/observation-relationshiptypes";
353      case DERIVEDFROM:
354        return "http://hl7.org/fhir/observation-relationshiptypes";
355      case SEQUELTO:
356        return "http://hl7.org/fhir/observation-relationshiptypes";
357      case REPLACES:
358        return "http://hl7.org/fhir/observation-relationshiptypes";
359      case QUALIFIEDBY:
360        return "http://hl7.org/fhir/observation-relationshiptypes";
361      case INTERFEREDBY:
362        return "http://hl7.org/fhir/observation-relationshiptypes";
363      case NULL:
364        return null;
365      default:
366        return "?";
367      }
368    }
369
370    public String getDefinition() {
371      switch (this) {
372      case HASMEMBER:
373        return "This observation is a group observation (e.g. a battery, a panel of tests, a set of vital sign measurements) that includes the target as a member of the group.";
374      case DERIVEDFROM:
375        return "The target resource (Observation or QuestionnaireResponse) is part of the information from which this observation value is derived. (e.g. calculated anion gap, Apgar score)  NOTE:  \"derived-from\" is only logical choice when referencing QuestionnaireResponse.";
376      case SEQUELTO:
377        return "This observation follows the target observation (e.g. timed tests such as Glucose Tolerance Test).";
378      case REPLACES:
379        return "This observation replaces a previous observation (i.e. a revised value). The target observation is now obsolete.";
380      case QUALIFIEDBY:
381        return "The value of the target observation qualifies (refines) the semantics of the source observation (e.g. a lipemia measure target from a plasma measure).";
382      case INTERFEREDBY:
383        return "The value of the target observation interferes (degrades quality, or prevents valid observation) with the semantics of the source observation (e.g. a hemolysis measure target from a plasma potassium measure which has no value).";
384      case NULL:
385        return null;
386      default:
387        return "?";
388      }
389    }
390
391    public String getDisplay() {
392      switch (this) {
393      case HASMEMBER:
394        return "Has Member";
395      case DERIVEDFROM:
396        return "Derived From";
397      case SEQUELTO:
398        return "Sequel To";
399      case REPLACES:
400        return "Replaces";
401      case QUALIFIEDBY:
402        return "Qualified By";
403      case INTERFEREDBY:
404        return "Interfered By";
405      case NULL:
406        return null;
407      default:
408        return "?";
409      }
410    }
411  }
412
413  public static class ObservationRelationshipTypeEnumFactory implements EnumFactory<ObservationRelationshipType> {
414    public ObservationRelationshipType fromCode(String codeString) throws IllegalArgumentException {
415      if (codeString == null || "".equals(codeString))
416        if (codeString == null || "".equals(codeString))
417          return null;
418      if ("has-member".equals(codeString))
419        return ObservationRelationshipType.HASMEMBER;
420      if ("derived-from".equals(codeString))
421        return ObservationRelationshipType.DERIVEDFROM;
422      if ("sequel-to".equals(codeString))
423        return ObservationRelationshipType.SEQUELTO;
424      if ("replaces".equals(codeString))
425        return ObservationRelationshipType.REPLACES;
426      if ("qualified-by".equals(codeString))
427        return ObservationRelationshipType.QUALIFIEDBY;
428      if ("interfered-by".equals(codeString))
429        return ObservationRelationshipType.INTERFEREDBY;
430      throw new IllegalArgumentException("Unknown ObservationRelationshipType code '" + codeString + "'");
431    }
432
433    public Enumeration<ObservationRelationshipType> fromType(Base code) throws FHIRException {
434      if (code == null || code.isEmpty())
435        return null;
436      String codeString = ((PrimitiveType) code).asStringValue();
437      if (codeString == null || "".equals(codeString))
438        return null;
439      if ("has-member".equals(codeString))
440        return new Enumeration<ObservationRelationshipType>(this, ObservationRelationshipType.HASMEMBER);
441      if ("derived-from".equals(codeString))
442        return new Enumeration<ObservationRelationshipType>(this, ObservationRelationshipType.DERIVEDFROM);
443      if ("sequel-to".equals(codeString))
444        return new Enumeration<ObservationRelationshipType>(this, ObservationRelationshipType.SEQUELTO);
445      if ("replaces".equals(codeString))
446        return new Enumeration<ObservationRelationshipType>(this, ObservationRelationshipType.REPLACES);
447      if ("qualified-by".equals(codeString))
448        return new Enumeration<ObservationRelationshipType>(this, ObservationRelationshipType.QUALIFIEDBY);
449      if ("interfered-by".equals(codeString))
450        return new Enumeration<ObservationRelationshipType>(this, ObservationRelationshipType.INTERFEREDBY);
451      throw new FHIRException("Unknown ObservationRelationshipType code '" + codeString + "'");
452    }
453
454    public String toCode(ObservationRelationshipType code) {
455      if (code == ObservationRelationshipType.HASMEMBER)
456        return "has-member";
457      if (code == ObservationRelationshipType.DERIVEDFROM)
458        return "derived-from";
459      if (code == ObservationRelationshipType.SEQUELTO)
460        return "sequel-to";
461      if (code == ObservationRelationshipType.REPLACES)
462        return "replaces";
463      if (code == ObservationRelationshipType.QUALIFIEDBY)
464        return "qualified-by";
465      if (code == ObservationRelationshipType.INTERFEREDBY)
466        return "interfered-by";
467      return "?";
468    }
469  }
470
471  @Block()
472  public static class ObservationReferenceRangeComponent extends BackboneElement implements IBaseBackboneElement {
473    /**
474     * The value of the low bound of the reference range. The low bound of the
475     * reference range endpoint is inclusive of the value (e.g. reference range is
476     * >=5 - <=9). If the low bound is omitted, it is assumed to be meaningless
477     * (e.g. reference range is <=2.3).
478     */
479    @Child(name = "low", type = {
480        SimpleQuantity.class }, order = 1, min = 0, max = 1, modifier = false, summary = false)
481    @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).")
482    protected SimpleQuantity low;
483
484    /**
485     * The value of the high bound of the reference range. The high bound of the
486     * reference range endpoint is inclusive of the value (e.g. reference range is
487     * >=5 - <=9). If the high bound is omitted, it is assumed to be meaningless
488     * (e.g. reference range is >= 2.3).
489     */
490    @Child(name = "high", type = {
491        SimpleQuantity.class }, order = 2, min = 0, max = 1, modifier = false, summary = false)
492    @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).")
493    protected SimpleQuantity high;
494
495    /**
496     * Code for the meaning of the reference range.
497     */
498    @Child(name = "meaning", type = {
499        CodeableConcept.class }, order = 3, min = 0, max = 1, modifier = false, summary = false)
500    @Description(shortDefinition = "Indicates the meaning/use of this range of this range", formalDefinition = "Code for the meaning of the reference range.")
501    protected CodeableConcept meaning;
502
503    /**
504     * The age at which this reference range is applicable. This is a neonatal age
505     * (e.g. number of weeks at term) if the meaning says so.
506     */
507    @Child(name = "age", type = { Range.class }, order = 4, min = 0, max = 1, modifier = false, summary = false)
508    @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.")
509    protected Range age;
510
511    /**
512     * Text based reference range in an observation which may be used when a
513     * quantitative range is not appropriate for an observation. An example would be
514     * a reference value of "Negative" or a list or table of 'normals'.
515     */
516    @Child(name = "text", type = { StringType.class }, order = 5, min = 0, max = 1, modifier = false, summary = false)
517    @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'.")
518    protected StringType text;
519
520    private static final long serialVersionUID = -238694788L;
521
522    /*
523     * Constructor
524     */
525    public ObservationReferenceRangeComponent() {
526      super();
527    }
528
529    /**
530     * @return {@link #low} (The value of the low bound of the reference range. The
531     *         low bound of the reference range endpoint is inclusive of the value
532     *         (e.g. reference range is >=5 - <=9). If the low bound is omitted, it
533     *         is assumed to be meaningless (e.g. reference range is <=2.3).)
534     */
535    public SimpleQuantity getLow() {
536      if (this.low == null)
537        if (Configuration.errorOnAutoCreate())
538          throw new Error("Attempt to auto-create ObservationReferenceRangeComponent.low");
539        else if (Configuration.doAutoCreate())
540          this.low = new SimpleQuantity(); // cc
541      return this.low;
542    }
543
544    public boolean hasLow() {
545      return this.low != null && !this.low.isEmpty();
546    }
547
548    /**
549     * @param value {@link #low} (The value of the low bound of the reference range.
550     *              The low bound of the reference range endpoint is inclusive of
551     *              the value (e.g. reference range is >=5 - <=9). If the low bound
552     *              is omitted, it is assumed to be meaningless (e.g. reference
553     *              range is <=2.3).)
554     */
555    public ObservationReferenceRangeComponent setLow(SimpleQuantity value) {
556      this.low = value;
557      return this;
558    }
559
560    /**
561     * @return {@link #high} (The value of the high bound of the reference range.
562     *         The high bound of the reference range endpoint is inclusive of the
563     *         value (e.g. reference range is >=5 - <=9). If the high bound is
564     *         omitted, it is assumed to be meaningless (e.g. reference range is >=
565     *         2.3).)
566     */
567    public SimpleQuantity getHigh() {
568      if (this.high == null)
569        if (Configuration.errorOnAutoCreate())
570          throw new Error("Attempt to auto-create ObservationReferenceRangeComponent.high");
571        else if (Configuration.doAutoCreate())
572          this.high = new SimpleQuantity(); // cc
573      return this.high;
574    }
575
576    public boolean hasHigh() {
577      return this.high != null && !this.high.isEmpty();
578    }
579
580    /**
581     * @param value {@link #high} (The value of the high bound of the reference
582     *              range. The high bound of the reference range endpoint is
583     *              inclusive of the value (e.g. reference range is >=5 - <=9). If
584     *              the high bound is omitted, it is assumed to be meaningless (e.g.
585     *              reference range is >= 2.3).)
586     */
587    public ObservationReferenceRangeComponent setHigh(SimpleQuantity value) {
588      this.high = value;
589      return this;
590    }
591
592    /**
593     * @return {@link #meaning} (Code for the meaning of the reference range.)
594     */
595    public CodeableConcept getMeaning() {
596      if (this.meaning == null)
597        if (Configuration.errorOnAutoCreate())
598          throw new Error("Attempt to auto-create ObservationReferenceRangeComponent.meaning");
599        else if (Configuration.doAutoCreate())
600          this.meaning = new CodeableConcept(); // cc
601      return this.meaning;
602    }
603
604    public boolean hasMeaning() {
605      return this.meaning != null && !this.meaning.isEmpty();
606    }
607
608    /**
609     * @param value {@link #meaning} (Code for the meaning of the reference range.)
610     */
611    public ObservationReferenceRangeComponent setMeaning(CodeableConcept value) {
612      this.meaning = value;
613      return this;
614    }
615
616    /**
617     * @return {@link #age} (The age at which this reference range is applicable.
618     *         This is a neonatal age (e.g. number of weeks at term) if the meaning
619     *         says so.)
620     */
621    public Range getAge() {
622      if (this.age == null)
623        if (Configuration.errorOnAutoCreate())
624          throw new Error("Attempt to auto-create ObservationReferenceRangeComponent.age");
625        else if (Configuration.doAutoCreate())
626          this.age = new Range(); // cc
627      return this.age;
628    }
629
630    public boolean hasAge() {
631      return this.age != null && !this.age.isEmpty();
632    }
633
634    /**
635     * @param value {@link #age} (The age at which this reference range is
636     *              applicable. This is a neonatal age (e.g. number of weeks at
637     *              term) if the meaning says so.)
638     */
639    public ObservationReferenceRangeComponent setAge(Range value) {
640      this.age = value;
641      return this;
642    }
643
644    /**
645     * @return {@link #text} (Text based reference range in an observation which may
646     *         be used when a quantitative range is not appropriate for an
647     *         observation. An example would be a reference value of "Negative" or a
648     *         list or table of 'normals'.). This is the underlying object with id,
649     *         value and extensions. The accessor "getText" gives direct access to
650     *         the value
651     */
652    public StringType getTextElement() {
653      if (this.text == null)
654        if (Configuration.errorOnAutoCreate())
655          throw new Error("Attempt to auto-create ObservationReferenceRangeComponent.text");
656        else if (Configuration.doAutoCreate())
657          this.text = new StringType(); // bb
658      return this.text;
659    }
660
661    public boolean hasTextElement() {
662      return this.text != null && !this.text.isEmpty();
663    }
664
665    public boolean hasText() {
666      return this.text != null && !this.text.isEmpty();
667    }
668
669    /**
670     * @param value {@link #text} (Text based reference range in an observation
671     *              which may be used when a quantitative range is not appropriate
672     *              for an observation. An example would be a reference value of
673     *              "Negative" or a list or table of 'normals'.). This is the
674     *              underlying object with id, value and extensions. The accessor
675     *              "getText" gives direct access to the value
676     */
677    public ObservationReferenceRangeComponent setTextElement(StringType value) {
678      this.text = value;
679      return this;
680    }
681
682    /**
683     * @return Text based reference range in an observation which may be used when a
684     *         quantitative range is not appropriate for an observation. An example
685     *         would be a reference value of "Negative" or a list or table of
686     *         'normals'.
687     */
688    public String getText() {
689      return this.text == null ? null : this.text.getValue();
690    }
691
692    /**
693     * @param value Text based reference range in an observation which may be used
694     *              when a quantitative range is not appropriate for an observation.
695     *              An example would be a reference value of "Negative" or a list or
696     *              table of 'normals'.
697     */
698    public ObservationReferenceRangeComponent setText(String value) {
699      if (Utilities.noString(value))
700        this.text = null;
701      else {
702        if (this.text == null)
703          this.text = new StringType();
704        this.text.setValue(value);
705      }
706      return this;
707    }
708
709    protected void listChildren(List<Property> childrenList) {
710      super.listChildren(childrenList);
711      childrenList.add(new Property("low", "SimpleQuantity",
712          "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).",
713          0, java.lang.Integer.MAX_VALUE, low));
714      childrenList.add(new Property("high", "SimpleQuantity",
715          "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).",
716          0, java.lang.Integer.MAX_VALUE, high));
717      childrenList.add(new Property("meaning", "CodeableConcept", "Code for the meaning of the reference range.", 0,
718          java.lang.Integer.MAX_VALUE, meaning));
719      childrenList.add(new Property("age", "Range",
720          "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.",
721          0, java.lang.Integer.MAX_VALUE, age));
722      childrenList.add(new Property("text", "string",
723          "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'.",
724          0, java.lang.Integer.MAX_VALUE, text));
725    }
726
727    @Override
728    public void setProperty(String name, Base value) throws FHIRException {
729      if (name.equals("low"))
730        this.low = castToSimpleQuantity(value); // SimpleQuantity
731      else if (name.equals("high"))
732        this.high = castToSimpleQuantity(value); // SimpleQuantity
733      else if (name.equals("meaning"))
734        this.meaning = castToCodeableConcept(value); // CodeableConcept
735      else if (name.equals("age"))
736        this.age = castToRange(value); // Range
737      else if (name.equals("text"))
738        this.text = castToString(value); // StringType
739      else
740        super.setProperty(name, value);
741    }
742
743    @Override
744    public Base addChild(String name) throws FHIRException {
745      if (name.equals("low")) {
746        this.low = new SimpleQuantity();
747        return this.low;
748      } else if (name.equals("high")) {
749        this.high = new SimpleQuantity();
750        return this.high;
751      } else if (name.equals("meaning")) {
752        this.meaning = new CodeableConcept();
753        return this.meaning;
754      } else if (name.equals("age")) {
755        this.age = new Range();
756        return this.age;
757      } else if (name.equals("text")) {
758        throw new FHIRException("Cannot call addChild on a singleton property Observation.text");
759      } else
760        return super.addChild(name);
761    }
762
763    public ObservationReferenceRangeComponent copy() {
764      ObservationReferenceRangeComponent dst = new ObservationReferenceRangeComponent();
765      copyValues(dst);
766      dst.low = low == null ? null : low.copy();
767      dst.high = high == null ? null : high.copy();
768      dst.meaning = meaning == null ? null : meaning.copy();
769      dst.age = age == null ? null : age.copy();
770      dst.text = text == null ? null : text.copy();
771      return dst;
772    }
773
774    @Override
775    public boolean equalsDeep(Base other) {
776      if (!super.equalsDeep(other))
777        return false;
778      if (!(other instanceof ObservationReferenceRangeComponent))
779        return false;
780      ObservationReferenceRangeComponent o = (ObservationReferenceRangeComponent) other;
781      return compareDeep(low, o.low, true) && compareDeep(high, o.high, true) && compareDeep(meaning, o.meaning, true)
782          && compareDeep(age, o.age, true) && compareDeep(text, o.text, true);
783    }
784
785    @Override
786    public boolean equalsShallow(Base other) {
787      if (!super.equalsShallow(other))
788        return false;
789      if (!(other instanceof ObservationReferenceRangeComponent))
790        return false;
791      ObservationReferenceRangeComponent o = (ObservationReferenceRangeComponent) other;
792      return compareValues(text, o.text, true);
793    }
794
795    public boolean isEmpty() {
796      return super.isEmpty() && (low == null || low.isEmpty()) && (high == null || high.isEmpty())
797          && (meaning == null || meaning.isEmpty()) && (age == null || age.isEmpty())
798          && (text == null || text.isEmpty());
799    }
800
801    public String fhirType() {
802      return "Observation.referenceRange";
803
804    }
805
806  }
807
808  @Block()
809  public static class ObservationRelatedComponent extends BackboneElement implements IBaseBackboneElement {
810    /**
811     * A code specifying the kind of relationship that exists with the target
812     * resource.
813     */
814    @Child(name = "type", type = { CodeType.class }, order = 1, min = 0, max = 1, modifier = false, summary = false)
815    @Description(shortDefinition = "has-member | derived-from | sequel-to | replaces | qualified-by | interfered-by", formalDefinition = "A code specifying the kind of relationship that exists with the target resource.")
816    protected Enumeration<ObservationRelationshipType> type;
817
818    /**
819     * A reference to the observation or [[[QuestionnaireResponse]]] resource that
820     * is related to this observation.
821     */
822    @Child(name = "target", type = { Observation.class,
823        QuestionnaireResponse.class }, order = 2, min = 1, max = 1, modifier = false, summary = false)
824    @Description(shortDefinition = "Resource that is related to this one", formalDefinition = "A reference to the observation or [[[QuestionnaireResponse]]] resource that is related to this observation.")
825    protected Reference target;
826
827    /**
828     * The actual object that is the target of the reference (A reference to the
829     * observation or [[[QuestionnaireResponse]]] resource that is related to this
830     * observation.)
831     */
832    protected Resource targetTarget;
833
834    private static final long serialVersionUID = 1541802577L;
835
836    /*
837     * Constructor
838     */
839    public ObservationRelatedComponent() {
840      super();
841    }
842
843    /*
844     * Constructor
845     */
846    public ObservationRelatedComponent(Reference target) {
847      super();
848      this.target = target;
849    }
850
851    /**
852     * @return {@link #type} (A code specifying the kind of relationship that exists
853     *         with the target resource.). This is the underlying object with id,
854     *         value and extensions. The accessor "getType" gives direct access to
855     *         the value
856     */
857    public Enumeration<ObservationRelationshipType> getTypeElement() {
858      if (this.type == null)
859        if (Configuration.errorOnAutoCreate())
860          throw new Error("Attempt to auto-create ObservationRelatedComponent.type");
861        else if (Configuration.doAutoCreate())
862          this.type = new Enumeration<ObservationRelationshipType>(new ObservationRelationshipTypeEnumFactory()); // bb
863      return this.type;
864    }
865
866    public boolean hasTypeElement() {
867      return this.type != null && !this.type.isEmpty();
868    }
869
870    public boolean hasType() {
871      return this.type != null && !this.type.isEmpty();
872    }
873
874    /**
875     * @param value {@link #type} (A code specifying the kind of relationship that
876     *              exists with the target resource.). This is the underlying object
877     *              with id, value and extensions. The accessor "getType" gives
878     *              direct access to the value
879     */
880    public ObservationRelatedComponent setTypeElement(Enumeration<ObservationRelationshipType> value) {
881      this.type = value;
882      return this;
883    }
884
885    /**
886     * @return A code specifying the kind of relationship that exists with the
887     *         target resource.
888     */
889    public ObservationRelationshipType getType() {
890      return this.type == null ? null : this.type.getValue();
891    }
892
893    /**
894     * @param value A code specifying the kind of relationship that exists with the
895     *              target resource.
896     */
897    public ObservationRelatedComponent setType(ObservationRelationshipType value) {
898      if (value == null)
899        this.type = null;
900      else {
901        if (this.type == null)
902          this.type = new Enumeration<ObservationRelationshipType>(new ObservationRelationshipTypeEnumFactory());
903        this.type.setValue(value);
904      }
905      return this;
906    }
907
908    /**
909     * @return {@link #target} (A reference to the observation or
910     *         [[[QuestionnaireResponse]]] resource that is related to this
911     *         observation.)
912     */
913    public Reference getTarget() {
914      if (this.target == null)
915        if (Configuration.errorOnAutoCreate())
916          throw new Error("Attempt to auto-create ObservationRelatedComponent.target");
917        else if (Configuration.doAutoCreate())
918          this.target = new Reference(); // cc
919      return this.target;
920    }
921
922    public boolean hasTarget() {
923      return this.target != null && !this.target.isEmpty();
924    }
925
926    /**
927     * @param value {@link #target} (A reference to the observation or
928     *              [[[QuestionnaireResponse]]] resource that is related to this
929     *              observation.)
930     */
931    public ObservationRelatedComponent setTarget(Reference value) {
932      this.target = value;
933      return this;
934    }
935
936    /**
937     * @return {@link #target} The actual object that is the target of the
938     *         reference. The reference library doesn't populate this, but you can
939     *         use it to hold the resource if you resolve it. (A reference to the
940     *         observation or [[[QuestionnaireResponse]]] resource that is related
941     *         to this observation.)
942     */
943    public Resource getTargetTarget() {
944      return this.targetTarget;
945    }
946
947    /**
948     * @param value {@link #target} The actual object that is the target of the
949     *              reference. The reference library doesn't use these, but you can
950     *              use it to hold the resource if you resolve it. (A reference to
951     *              the observation or [[[QuestionnaireResponse]]] resource that is
952     *              related to this observation.)
953     */
954    public ObservationRelatedComponent setTargetTarget(Resource value) {
955      this.targetTarget = value;
956      return this;
957    }
958
959    protected void listChildren(List<Property> childrenList) {
960      super.listChildren(childrenList);
961      childrenList.add(new Property("type", "code",
962          "A code specifying the kind of relationship that exists with the target resource.", 0,
963          java.lang.Integer.MAX_VALUE, type));
964      childrenList.add(new Property("target", "Reference(Observation|QuestionnaireResponse)",
965          "A reference to the observation or [[[QuestionnaireResponse]]] resource that is related to this observation.",
966          0, java.lang.Integer.MAX_VALUE, target));
967    }
968
969    @Override
970    public void setProperty(String name, Base value) throws FHIRException {
971      if (name.equals("type"))
972        this.type = new ObservationRelationshipTypeEnumFactory().fromType(value); // Enumeration<ObservationRelationshipType>
973      else if (name.equals("target"))
974        this.target = castToReference(value); // Reference
975      else
976        super.setProperty(name, value);
977    }
978
979    @Override
980    public Base addChild(String name) throws FHIRException {
981      if (name.equals("type")) {
982        throw new FHIRException("Cannot call addChild on a singleton property Observation.type");
983      } else if (name.equals("target")) {
984        this.target = new Reference();
985        return this.target;
986      } else
987        return super.addChild(name);
988    }
989
990    public ObservationRelatedComponent copy() {
991      ObservationRelatedComponent dst = new ObservationRelatedComponent();
992      copyValues(dst);
993      dst.type = type == null ? null : type.copy();
994      dst.target = target == null ? null : target.copy();
995      return dst;
996    }
997
998    @Override
999    public boolean equalsDeep(Base other) {
1000      if (!super.equalsDeep(other))
1001        return false;
1002      if (!(other instanceof ObservationRelatedComponent))
1003        return false;
1004      ObservationRelatedComponent o = (ObservationRelatedComponent) other;
1005      return compareDeep(type, o.type, true) && compareDeep(target, o.target, true);
1006    }
1007
1008    @Override
1009    public boolean equalsShallow(Base other) {
1010      if (!super.equalsShallow(other))
1011        return false;
1012      if (!(other instanceof ObservationRelatedComponent))
1013        return false;
1014      ObservationRelatedComponent o = (ObservationRelatedComponent) other;
1015      return compareValues(type, o.type, true);
1016    }
1017
1018    public boolean isEmpty() {
1019      return super.isEmpty() && (type == null || type.isEmpty()) && (target == null || target.isEmpty());
1020    }
1021
1022    public String fhirType() {
1023      return "Observation.related";
1024
1025    }
1026
1027  }
1028
1029  @Block()
1030  public static class ObservationComponentComponent extends BackboneElement implements IBaseBackboneElement {
1031    /**
1032     * Describes what was observed. Sometimes this is called the observation "code".
1033     */
1034    @Child(name = "code", type = {
1035        CodeableConcept.class }, order = 1, min = 1, max = 1, modifier = false, summary = true)
1036    @Description(shortDefinition = "Type of component observation (code / type)", formalDefinition = "Describes what was observed. Sometimes this is called the observation \"code\".")
1037    protected CodeableConcept code;
1038
1039    /**
1040     * The information determined as a result of making the observation, if the
1041     * information has a simple value.
1042     */
1043    @Child(name = "value", type = { Quantity.class, CodeableConcept.class, StringType.class, Range.class, Ratio.class,
1044        SampledData.class, Attachment.class, TimeType.class, DateTimeType.class,
1045        Period.class }, order = 2, min = 0, max = 1, modifier = false, summary = true)
1046    @Description(shortDefinition = "Actual component result", formalDefinition = "The information determined as a result of making the observation, if the information has a simple value.")
1047    protected Type value;
1048
1049    /**
1050     * Provides a reason why the expected value in the element Observation.value[x]
1051     * is missing.
1052     */
1053    @Child(name = "dataAbsentReason", type = {
1054        CodeableConcept.class }, order = 3, min = 0, max = 1, modifier = false, summary = false)
1055    @Description(shortDefinition = "Why the component result is missing", formalDefinition = "Provides a reason why the expected value in the element Observation.value[x] is missing.")
1056    protected CodeableConcept dataAbsentReason;
1057
1058    /**
1059     * Guidance on how to interpret the value by comparison to a normal or
1060     * recommended range.
1061     */
1062    @Child(name = "referenceRange", type = {
1063        ObservationReferenceRangeComponent.class }, order = 4, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
1064    @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.")
1065    protected List<ObservationReferenceRangeComponent> referenceRange;
1066
1067    private static final long serialVersionUID = 946602904L;
1068
1069    /*
1070     * Constructor
1071     */
1072    public ObservationComponentComponent() {
1073      super();
1074    }
1075
1076    /*
1077     * Constructor
1078     */
1079    public ObservationComponentComponent(CodeableConcept code) {
1080      super();
1081      this.code = code;
1082    }
1083
1084    /**
1085     * @return {@link #code} (Describes what was observed. Sometimes this is called
1086     *         the observation "code".)
1087     */
1088    public CodeableConcept getCode() {
1089      if (this.code == null)
1090        if (Configuration.errorOnAutoCreate())
1091          throw new Error("Attempt to auto-create ObservationComponentComponent.code");
1092        else if (Configuration.doAutoCreate())
1093          this.code = new CodeableConcept(); // cc
1094      return this.code;
1095    }
1096
1097    public boolean hasCode() {
1098      return this.code != null && !this.code.isEmpty();
1099    }
1100
1101    /**
1102     * @param value {@link #code} (Describes what was observed. Sometimes this is
1103     *              called the observation "code".)
1104     */
1105    public ObservationComponentComponent setCode(CodeableConcept value) {
1106      this.code = value;
1107      return this;
1108    }
1109
1110    /**
1111     * @return {@link #value} (The information determined as a result of making the
1112     *         observation, if the information has a simple value.)
1113     */
1114    public Type getValue() {
1115      return this.value;
1116    }
1117
1118    /**
1119     * @return {@link #value} (The information determined as a result of making the
1120     *         observation, if the information has a simple value.)
1121     */
1122    public Quantity getValueQuantity() throws FHIRException {
1123      if (!(this.value instanceof Quantity))
1124        throw new FHIRException("Type mismatch: the type Quantity was expected, but " + this.value.getClass().getName()
1125            + " was encountered");
1126      return (Quantity) this.value;
1127    }
1128
1129    public boolean hasValueQuantity() {
1130      return this.value instanceof Quantity;
1131    }
1132
1133    /**
1134     * @return {@link #value} (The information determined as a result of making the
1135     *         observation, if the information has a simple value.)
1136     */
1137    public CodeableConcept getValueCodeableConcept() throws FHIRException {
1138      if (!(this.value instanceof CodeableConcept))
1139        throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "
1140            + this.value.getClass().getName() + " was encountered");
1141      return (CodeableConcept) this.value;
1142    }
1143
1144    public boolean hasValueCodeableConcept() {
1145      return this.value instanceof CodeableConcept;
1146    }
1147
1148    /**
1149     * @return {@link #value} (The information determined as a result of making the
1150     *         observation, if the information has a simple value.)
1151     */
1152    public StringType getValueStringType() throws FHIRException {
1153      if (!(this.value instanceof StringType))
1154        throw new FHIRException("Type mismatch: the type StringType was expected, but "
1155            + this.value.getClass().getName() + " was encountered");
1156      return (StringType) this.value;
1157    }
1158
1159    public boolean hasValueStringType() {
1160      return this.value instanceof StringType;
1161    }
1162
1163    /**
1164     * @return {@link #value} (The information determined as a result of making the
1165     *         observation, if the information has a simple value.)
1166     */
1167    public Range getValueRange() throws FHIRException {
1168      if (!(this.value instanceof Range))
1169        throw new FHIRException(
1170            "Type mismatch: the type Range was expected, but " + this.value.getClass().getName() + " was encountered");
1171      return (Range) this.value;
1172    }
1173
1174    public boolean hasValueRange() {
1175      return this.value instanceof Range;
1176    }
1177
1178    /**
1179     * @return {@link #value} (The information determined as a result of making the
1180     *         observation, if the information has a simple value.)
1181     */
1182    public Ratio getValueRatio() throws FHIRException {
1183      if (!(this.value instanceof Ratio))
1184        throw new FHIRException(
1185            "Type mismatch: the type Ratio was expected, but " + this.value.getClass().getName() + " was encountered");
1186      return (Ratio) this.value;
1187    }
1188
1189    public boolean hasValueRatio() {
1190      return this.value instanceof Ratio;
1191    }
1192
1193    /**
1194     * @return {@link #value} (The information determined as a result of making the
1195     *         observation, if the information has a simple value.)
1196     */
1197    public SampledData getValueSampledData() throws FHIRException {
1198      if (!(this.value instanceof SampledData))
1199        throw new FHIRException("Type mismatch: the type SampledData was expected, but "
1200            + this.value.getClass().getName() + " was encountered");
1201      return (SampledData) this.value;
1202    }
1203
1204    public boolean hasValueSampledData() {
1205      return this.value instanceof SampledData;
1206    }
1207
1208    /**
1209     * @return {@link #value} (The information determined as a result of making the
1210     *         observation, if the information has a simple value.)
1211     */
1212    public Attachment getValueAttachment() throws FHIRException {
1213      if (!(this.value instanceof Attachment))
1214        throw new FHIRException("Type mismatch: the type Attachment was expected, but "
1215            + this.value.getClass().getName() + " was encountered");
1216      return (Attachment) this.value;
1217    }
1218
1219    public boolean hasValueAttachment() {
1220      return this.value instanceof Attachment;
1221    }
1222
1223    /**
1224     * @return {@link #value} (The information determined as a result of making the
1225     *         observation, if the information has a simple value.)
1226     */
1227    public TimeType getValueTimeType() throws FHIRException {
1228      if (!(this.value instanceof TimeType))
1229        throw new FHIRException("Type mismatch: the type TimeType was expected, but " + this.value.getClass().getName()
1230            + " was encountered");
1231      return (TimeType) this.value;
1232    }
1233
1234    public boolean hasValueTimeType() {
1235      return this.value instanceof TimeType;
1236    }
1237
1238    /**
1239     * @return {@link #value} (The information determined as a result of making the
1240     *         observation, if the information has a simple value.)
1241     */
1242    public DateTimeType getValueDateTimeType() throws FHIRException {
1243      if (!(this.value instanceof DateTimeType))
1244        throw new FHIRException("Type mismatch: the type DateTimeType was expected, but "
1245            + this.value.getClass().getName() + " was encountered");
1246      return (DateTimeType) this.value;
1247    }
1248
1249    public boolean hasValueDateTimeType() {
1250      return this.value instanceof DateTimeType;
1251    }
1252
1253    /**
1254     * @return {@link #value} (The information determined as a result of making the
1255     *         observation, if the information has a simple value.)
1256     */
1257    public Period getValuePeriod() throws FHIRException {
1258      if (!(this.value instanceof Period))
1259        throw new FHIRException(
1260            "Type mismatch: the type Period was expected, but " + this.value.getClass().getName() + " was encountered");
1261      return (Period) this.value;
1262    }
1263
1264    public boolean hasValuePeriod() {
1265      return this.value instanceof Period;
1266    }
1267
1268    public boolean hasValue() {
1269      return this.value != null && !this.value.isEmpty();
1270    }
1271
1272    /**
1273     * @param value {@link #value} (The information determined as a result of making
1274     *              the observation, if the information has a simple value.)
1275     */
1276    public ObservationComponentComponent setValue(Type value) {
1277      this.value = value;
1278      return this;
1279    }
1280
1281    /**
1282     * @return {@link #dataAbsentReason} (Provides a reason why the expected value
1283     *         in the element Observation.value[x] is missing.)
1284     */
1285    public CodeableConcept getDataAbsentReason() {
1286      if (this.dataAbsentReason == null)
1287        if (Configuration.errorOnAutoCreate())
1288          throw new Error("Attempt to auto-create ObservationComponentComponent.dataAbsentReason");
1289        else if (Configuration.doAutoCreate())
1290          this.dataAbsentReason = new CodeableConcept(); // cc
1291      return this.dataAbsentReason;
1292    }
1293
1294    public boolean hasDataAbsentReason() {
1295      return this.dataAbsentReason != null && !this.dataAbsentReason.isEmpty();
1296    }
1297
1298    /**
1299     * @param value {@link #dataAbsentReason} (Provides a reason why the expected
1300     *              value in the element Observation.value[x] is missing.)
1301     */
1302    public ObservationComponentComponent setDataAbsentReason(CodeableConcept value) {
1303      this.dataAbsentReason = value;
1304      return this;
1305    }
1306
1307    /**
1308     * @return {@link #referenceRange} (Guidance on how to interpret the value by
1309     *         comparison to a normal or recommended range.)
1310     */
1311    public List<ObservationReferenceRangeComponent> getReferenceRange() {
1312      if (this.referenceRange == null)
1313        this.referenceRange = new ArrayList<ObservationReferenceRangeComponent>();
1314      return this.referenceRange;
1315    }
1316
1317    public boolean hasReferenceRange() {
1318      if (this.referenceRange == null)
1319        return false;
1320      for (ObservationReferenceRangeComponent item : this.referenceRange)
1321        if (!item.isEmpty())
1322          return true;
1323      return false;
1324    }
1325
1326    /**
1327     * @return {@link #referenceRange} (Guidance on how to interpret the value by
1328     *         comparison to a normal or recommended range.)
1329     */
1330    // syntactic sugar
1331    public ObservationReferenceRangeComponent addReferenceRange() { // 3
1332      ObservationReferenceRangeComponent t = new ObservationReferenceRangeComponent();
1333      if (this.referenceRange == null)
1334        this.referenceRange = new ArrayList<ObservationReferenceRangeComponent>();
1335      this.referenceRange.add(t);
1336      return t;
1337    }
1338
1339    // syntactic sugar
1340    public ObservationComponentComponent addReferenceRange(ObservationReferenceRangeComponent t) { // 3
1341      if (t == null)
1342        return this;
1343      if (this.referenceRange == null)
1344        this.referenceRange = new ArrayList<ObservationReferenceRangeComponent>();
1345      this.referenceRange.add(t);
1346      return this;
1347    }
1348
1349    protected void listChildren(List<Property> childrenList) {
1350      super.listChildren(childrenList);
1351      childrenList.add(new Property("code", "CodeableConcept",
1352          "Describes what was observed. Sometimes this is called the observation \"code\".", 0,
1353          java.lang.Integer.MAX_VALUE, code));
1354      childrenList.add(new Property("value[x]",
1355          "Quantity|CodeableConcept|string|Range|Ratio|SampledData|Attachment|time|dateTime|Period",
1356          "The information determined as a result of making the observation, if the information has a simple value.", 0,
1357          java.lang.Integer.MAX_VALUE, value));
1358      childrenList.add(new Property("dataAbsentReason", "CodeableConcept",
1359          "Provides a reason why the expected value in the element Observation.value[x] is missing.", 0,
1360          java.lang.Integer.MAX_VALUE, dataAbsentReason));
1361      childrenList.add(new Property("referenceRange", "@Observation.referenceRange",
1362          "Guidance on how to interpret the value by comparison to a normal or recommended range.", 0,
1363          java.lang.Integer.MAX_VALUE, referenceRange));
1364    }
1365
1366    @Override
1367    public void setProperty(String name, Base value) throws FHIRException {
1368      if (name.equals("code"))
1369        this.code = castToCodeableConcept(value); // CodeableConcept
1370      else if (name.equals("value[x]"))
1371        this.value = (Type) value; // Type
1372      else if (name.equals("dataAbsentReason"))
1373        this.dataAbsentReason = castToCodeableConcept(value); // CodeableConcept
1374      else if (name.equals("referenceRange"))
1375        this.getReferenceRange().add((ObservationReferenceRangeComponent) value);
1376      else
1377        super.setProperty(name, value);
1378    }
1379
1380    @Override
1381    public Base addChild(String name) throws FHIRException {
1382      if (name.equals("code")) {
1383        this.code = new CodeableConcept();
1384        return this.code;
1385      } else if (name.equals("valueQuantity")) {
1386        this.value = new Quantity();
1387        return this.value;
1388      } else if (name.equals("valueCodeableConcept")) {
1389        this.value = new CodeableConcept();
1390        return this.value;
1391      } else if (name.equals("valueString")) {
1392        this.value = new StringType();
1393        return this.value;
1394      } else if (name.equals("valueRange")) {
1395        this.value = new Range();
1396        return this.value;
1397      } else if (name.equals("valueRatio")) {
1398        this.value = new Ratio();
1399        return this.value;
1400      } else if (name.equals("valueSampledData")) {
1401        this.value = new SampledData();
1402        return this.value;
1403      } else if (name.equals("valueAttachment")) {
1404        this.value = new Attachment();
1405        return this.value;
1406      } else if (name.equals("valueTime")) {
1407        this.value = new TimeType();
1408        return this.value;
1409      } else if (name.equals("valueDateTime")) {
1410        this.value = new DateTimeType();
1411        return this.value;
1412      } else if (name.equals("valuePeriod")) {
1413        this.value = new Period();
1414        return this.value;
1415      } else if (name.equals("dataAbsentReason")) {
1416        this.dataAbsentReason = new CodeableConcept();
1417        return this.dataAbsentReason;
1418      } else if (name.equals("referenceRange")) {
1419        return addReferenceRange();
1420      } else
1421        return super.addChild(name);
1422    }
1423
1424    public ObservationComponentComponent copy() {
1425      ObservationComponentComponent dst = new ObservationComponentComponent();
1426      copyValues(dst);
1427      dst.code = code == null ? null : code.copy();
1428      dst.value = value == null ? null : value.copy();
1429      dst.dataAbsentReason = dataAbsentReason == null ? null : dataAbsentReason.copy();
1430      if (referenceRange != null) {
1431        dst.referenceRange = new ArrayList<ObservationReferenceRangeComponent>();
1432        for (ObservationReferenceRangeComponent i : referenceRange)
1433          dst.referenceRange.add(i.copy());
1434      }
1435      ;
1436      return dst;
1437    }
1438
1439    @Override
1440    public boolean equalsDeep(Base other) {
1441      if (!super.equalsDeep(other))
1442        return false;
1443      if (!(other instanceof ObservationComponentComponent))
1444        return false;
1445      ObservationComponentComponent o = (ObservationComponentComponent) other;
1446      return compareDeep(code, o.code, true) && compareDeep(value, o.value, true)
1447          && compareDeep(dataAbsentReason, o.dataAbsentReason, true)
1448          && compareDeep(referenceRange, o.referenceRange, true);
1449    }
1450
1451    @Override
1452    public boolean equalsShallow(Base other) {
1453      if (!super.equalsShallow(other))
1454        return false;
1455      if (!(other instanceof ObservationComponentComponent))
1456        return false;
1457      ObservationComponentComponent o = (ObservationComponentComponent) other;
1458      return true;
1459    }
1460
1461    public boolean isEmpty() {
1462      return super.isEmpty() && (code == null || code.isEmpty()) && (value == null || value.isEmpty())
1463          && (dataAbsentReason == null || dataAbsentReason.isEmpty())
1464          && (referenceRange == null || referenceRange.isEmpty());
1465    }
1466
1467    public String fhirType() {
1468      return "Observation.component";
1469
1470    }
1471
1472  }
1473
1474  /**
1475   * A unique identifier for the simple observation instance.
1476   */
1477  @Child(name = "identifier", type = {
1478      Identifier.class }, order = 0, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
1479  @Description(shortDefinition = "Unique Id for this particular observation", formalDefinition = "A unique identifier for the simple observation instance.")
1480  protected List<Identifier> identifier;
1481
1482  /**
1483   * The status of the result value.
1484   */
1485  @Child(name = "status", type = { CodeType.class }, order = 1, min = 1, max = 1, modifier = true, summary = true)
1486  @Description(shortDefinition = "registered | preliminary | final | amended +", formalDefinition = "The status of the result value.")
1487  protected Enumeration<ObservationStatus> status;
1488
1489  /**
1490   * A code that classifies the general type of observation being made. This is
1491   * used for searching, sorting and display purposes.
1492   */
1493  @Child(name = "category", type = {
1494      CodeableConcept.class }, order = 2, min = 0, max = 1, modifier = false, summary = false)
1495  @Description(shortDefinition = "Classification of  type of observation", formalDefinition = "A code that classifies the general type of observation being made.  This is used  for searching, sorting and display purposes.")
1496  protected CodeableConcept category;
1497
1498  /**
1499   * Describes what was observed. Sometimes this is called the observation "name".
1500   */
1501  @Child(name = "code", type = { CodeableConcept.class }, order = 3, min = 1, max = 1, modifier = false, summary = true)
1502  @Description(shortDefinition = "Type of observation (code / type)", formalDefinition = "Describes what was observed. Sometimes this is called the observation \"name\".")
1503  protected CodeableConcept code;
1504
1505  /**
1506   * The patient, or group of patients, location, or device whose characteristics
1507   * (direct or indirect) are described by the observation and into whose record
1508   * the observation is placed. Comments: Indirect characteristics may be those of
1509   * a specimen, fetus, donor, other observer (for example a relative or EMT), or
1510   * any observation made about the subject.
1511   */
1512  @Child(name = "subject", type = { Patient.class, Group.class, Device.class,
1513      Location.class }, order = 4, min = 0, max = 1, modifier = false, summary = true)
1514  @Description(shortDefinition = "Who and/or what this is about", formalDefinition = "The patient, or group of patients, location, or device whose characteristics (direct or indirect) are described by the observation and into whose record the observation is placed.  Comments: Indirect characteristics may be those of a specimen, fetus, donor,  other observer (for example a relative or EMT), or any observation made about the subject.")
1515  protected Reference subject;
1516
1517  /**
1518   * The actual object that is the target of the reference (The patient, or group
1519   * of patients, location, or device whose characteristics (direct or indirect)
1520   * are described by the observation and into whose record the observation is
1521   * placed. Comments: Indirect characteristics may be those of a specimen, fetus,
1522   * donor, other observer (for example a relative or EMT), or any observation
1523   * made about the subject.)
1524   */
1525  protected Resource subjectTarget;
1526
1527  /**
1528   * The healthcare event (e.g. a patient and healthcare provider interaction)
1529   * during which this observation is made.
1530   */
1531  @Child(name = "encounter", type = { Encounter.class }, order = 5, min = 0, max = 1, modifier = false, summary = false)
1532  @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.")
1533  protected Reference encounter;
1534
1535  /**
1536   * The actual object that is the target of the reference (The healthcare event
1537   * (e.g. a patient and healthcare provider interaction) during which this
1538   * observation is made.)
1539   */
1540  protected Encounter encounterTarget;
1541
1542  /**
1543   * The time or time-period the observed value is asserted as being true. For
1544   * biological subjects - e.g. human patients - this is usually called the
1545   * "physiologically relevant time". This is usually either the time of the
1546   * procedure or of specimen collection, but very often the source of the
1547   * date/time is not known, only the date/time itself.
1548   */
1549  @Child(name = "effective", type = { DateTimeType.class,
1550      Period.class }, order = 6, min = 0, max = 1, modifier = false, summary = true)
1551  @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.")
1552  protected Type effective;
1553
1554  /**
1555   * The date and time this observation was made available to providers, typically
1556   * after the results have been reviewed and verified.
1557   */
1558  @Child(name = "issued", type = { InstantType.class }, order = 7, min = 0, max = 1, modifier = false, summary = true)
1559  @Description(shortDefinition = "Date/Time this was made available", formalDefinition = "The date and time this observation was made available to providers, typically after the results have been reviewed and verified.")
1560  protected InstantType issued;
1561
1562  /**
1563   * Who was responsible for asserting the observed value as "true".
1564   */
1565  @Child(name = "performer", type = { Practitioner.class, Organization.class, Patient.class,
1566      RelatedPerson.class }, order = 8, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
1567  @Description(shortDefinition = "Who is responsible for the observation", formalDefinition = "Who was responsible for asserting the observed value as \"true\".")
1568  protected List<Reference> performer;
1569  /**
1570   * The actual objects that are the target of the reference (Who was responsible
1571   * for asserting the observed value as "true".)
1572   */
1573  protected List<Resource> performerTarget;
1574
1575  /**
1576   * The information determined as a result of making the observation, if the
1577   * information has a simple value.
1578   */
1579  @Child(name = "value", type = { Quantity.class, CodeableConcept.class, StringType.class, Range.class, Ratio.class,
1580      SampledData.class, Attachment.class, TimeType.class, DateTimeType.class,
1581      Period.class }, order = 9, min = 0, max = 1, modifier = false, summary = true)
1582  @Description(shortDefinition = "Actual result", formalDefinition = "The information determined as a result of making the observation, if the information has a simple value.")
1583  protected Type value;
1584
1585  /**
1586   * Provides a reason why the expected value in the element Observation.value[x]
1587   * is missing.
1588   */
1589  @Child(name = "dataAbsentReason", type = {
1590      CodeableConcept.class }, order = 10, min = 0, max = 1, modifier = false, summary = false)
1591  @Description(shortDefinition = "Why the result is missing", formalDefinition = "Provides a reason why the expected value in the element Observation.value[x] is missing.")
1592  protected CodeableConcept dataAbsentReason;
1593
1594  /**
1595   * The assessment made based on the result of the observation. Intended as a
1596   * simple compact code often placed adjacent to the result value in reports and
1597   * flow sheets to signal the meaning/normalcy status of the result. Otherwise
1598   * known as abnormal flag.
1599   */
1600  @Child(name = "interpretation", type = {
1601      CodeableConcept.class }, order = 11, min = 0, max = 1, modifier = false, summary = false)
1602  @Description(shortDefinition = "High, low, normal, etc.", formalDefinition = "The assessment made based on the result of the observation.  Intended as a simple compact code often placed adjacent to the result value in reports and flow sheets to signal the meaning/normalcy status of the result. Otherwise known as abnormal flag.")
1603  protected CodeableConcept interpretation;
1604
1605  /**
1606   * May include statements about significant, unexpected or unreliable values, or
1607   * information about the source of the value where this may be relevant to the
1608   * interpretation of the result.
1609   */
1610  @Child(name = "comments", type = {
1611      StringType.class }, order = 12, min = 0, max = 1, modifier = false, summary = false)
1612  @Description(shortDefinition = "Comments about result", formalDefinition = "May include statements about significant, unexpected or unreliable values, or information about the source of the value where this may be relevant to the interpretation of the result.")
1613  protected StringType comments;
1614
1615  /**
1616   * Indicates the site on the subject's body where the observation was made (i.e.
1617   * the target site).
1618   */
1619  @Child(name = "bodySite", type = {
1620      CodeableConcept.class }, order = 13, min = 0, max = 1, modifier = false, summary = false)
1621  @Description(shortDefinition = "Observed body part", formalDefinition = "Indicates the site on the subject's body where the observation was made (i.e. the target site).")
1622  protected CodeableConcept bodySite;
1623
1624  /**
1625   * Indicates the mechanism used to perform the observation.
1626   */
1627  @Child(name = "method", type = {
1628      CodeableConcept.class }, order = 14, min = 0, max = 1, modifier = false, summary = false)
1629  @Description(shortDefinition = "How it was done", formalDefinition = "Indicates the mechanism used to perform the observation.")
1630  protected CodeableConcept method;
1631
1632  /**
1633   * The specimen that was used when this observation was made.
1634   */
1635  @Child(name = "specimen", type = { Specimen.class }, order = 15, min = 0, max = 1, modifier = false, summary = false)
1636  @Description(shortDefinition = "Specimen used for this observation", formalDefinition = "The specimen that was used when this observation was made.")
1637  protected Reference specimen;
1638
1639  /**
1640   * The actual object that is the target of the reference (The specimen that was
1641   * used when this observation was made.)
1642   */
1643  protected Specimen specimenTarget;
1644
1645  /**
1646   * The device used to generate the observation data.
1647   */
1648  @Child(name = "device", type = { Device.class,
1649      DeviceMetric.class }, order = 16, min = 0, max = 1, modifier = false, summary = false)
1650  @Description(shortDefinition = "(Measurement) Device", formalDefinition = "The device used to generate the observation data.")
1651  protected Reference device;
1652
1653  /**
1654   * The actual object that is the target of the reference (The device used to
1655   * generate the observation data.)
1656   */
1657  protected Resource deviceTarget;
1658
1659  /**
1660   * Guidance on how to interpret the value by comparison to a normal or
1661   * recommended range.
1662   */
1663  @Child(name = "referenceRange", type = {}, order = 17, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
1664  @Description(shortDefinition = "Provides guide for interpretation", formalDefinition = "Guidance on how to interpret the value by comparison to a normal or recommended range.")
1665  protected List<ObservationReferenceRangeComponent> referenceRange;
1666
1667  /**
1668   * A reference to another resource (usually another Observation but could also
1669   * be a QuestionnaireAnswer) whose relationship is defined by the relationship
1670   * type code.
1671   */
1672  @Child(name = "related", type = {}, order = 18, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
1673  @Description(shortDefinition = "Resource related to this observation", formalDefinition = "A  reference to another resource (usually another Observation but could  also be a QuestionnaireAnswer) whose relationship is defined by the relationship type code.")
1674  protected List<ObservationRelatedComponent> related;
1675
1676  /**
1677   * Some observations have multiple component observations. These component
1678   * observations are expressed as separate code value pairs that share the same
1679   * attributes. Examples include systolic and diastolic component observations
1680   * for blood pressure measurement and multiple component observations for
1681   * genetics observations.
1682   */
1683  @Child(name = "component", type = {}, order = 19, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
1684  @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.")
1685  protected List<ObservationComponentComponent> component;
1686
1687  private static final long serialVersionUID = -931593572L;
1688
1689  /*
1690   * Constructor
1691   */
1692  public Observation() {
1693    super();
1694  }
1695
1696  /*
1697   * Constructor
1698   */
1699  public Observation(Enumeration<ObservationStatus> status, CodeableConcept code) {
1700    super();
1701    this.status = status;
1702    this.code = code;
1703  }
1704
1705  /**
1706   * @return {@link #identifier} (A unique identifier for the simple observation
1707   *         instance.)
1708   */
1709  public List<Identifier> getIdentifier() {
1710    if (this.identifier == null)
1711      this.identifier = new ArrayList<Identifier>();
1712    return this.identifier;
1713  }
1714
1715  public boolean hasIdentifier() {
1716    if (this.identifier == null)
1717      return false;
1718    for (Identifier item : this.identifier)
1719      if (!item.isEmpty())
1720        return true;
1721    return false;
1722  }
1723
1724  /**
1725   * @return {@link #identifier} (A unique identifier for the simple observation
1726   *         instance.)
1727   */
1728  // syntactic sugar
1729  public Identifier addIdentifier() { // 3
1730    Identifier t = new Identifier();
1731    if (this.identifier == null)
1732      this.identifier = new ArrayList<Identifier>();
1733    this.identifier.add(t);
1734    return t;
1735  }
1736
1737  // syntactic sugar
1738  public Observation addIdentifier(Identifier t) { // 3
1739    if (t == null)
1740      return this;
1741    if (this.identifier == null)
1742      this.identifier = new ArrayList<Identifier>();
1743    this.identifier.add(t);
1744    return this;
1745  }
1746
1747  /**
1748   * @return {@link #status} (The status of the result value.). This is the
1749   *         underlying object with id, value and extensions. The accessor
1750   *         "getStatus" gives direct access to the value
1751   */
1752  public Enumeration<ObservationStatus> getStatusElement() {
1753    if (this.status == null)
1754      if (Configuration.errorOnAutoCreate())
1755        throw new Error("Attempt to auto-create Observation.status");
1756      else if (Configuration.doAutoCreate())
1757        this.status = new Enumeration<ObservationStatus>(new ObservationStatusEnumFactory()); // bb
1758    return this.status;
1759  }
1760
1761  public boolean hasStatusElement() {
1762    return this.status != null && !this.status.isEmpty();
1763  }
1764
1765  public boolean hasStatus() {
1766    return this.status != null && !this.status.isEmpty();
1767  }
1768
1769  /**
1770   * @param value {@link #status} (The status of the result value.). This is the
1771   *              underlying object with id, value and extensions. The accessor
1772   *              "getStatus" gives direct access to the value
1773   */
1774  public Observation setStatusElement(Enumeration<ObservationStatus> value) {
1775    this.status = value;
1776    return this;
1777  }
1778
1779  /**
1780   * @return The status of the result value.
1781   */
1782  public ObservationStatus getStatus() {
1783    return this.status == null ? null : this.status.getValue();
1784  }
1785
1786  /**
1787   * @param value The status of the result value.
1788   */
1789  public Observation setStatus(ObservationStatus value) {
1790    if (this.status == null)
1791      this.status = new Enumeration<ObservationStatus>(new ObservationStatusEnumFactory());
1792    this.status.setValue(value);
1793    return this;
1794  }
1795
1796  /**
1797   * @return {@link #category} (A code that classifies the general type of
1798   *         observation being made. This is used for searching, sorting and
1799   *         display purposes.)
1800   */
1801  public CodeableConcept getCategory() {
1802    if (this.category == null)
1803      if (Configuration.errorOnAutoCreate())
1804        throw new Error("Attempt to auto-create Observation.category");
1805      else if (Configuration.doAutoCreate())
1806        this.category = new CodeableConcept(); // cc
1807    return this.category;
1808  }
1809
1810  public boolean hasCategory() {
1811    return this.category != null && !this.category.isEmpty();
1812  }
1813
1814  /**
1815   * @param value {@link #category} (A code that classifies the general type of
1816   *              observation being made. This is used for searching, sorting and
1817   *              display purposes.)
1818   */
1819  public Observation setCategory(CodeableConcept value) {
1820    this.category = value;
1821    return this;
1822  }
1823
1824  /**
1825   * @return {@link #code} (Describes what was observed. Sometimes this is called
1826   *         the observation "name".)
1827   */
1828  public CodeableConcept getCode() {
1829    if (this.code == null)
1830      if (Configuration.errorOnAutoCreate())
1831        throw new Error("Attempt to auto-create Observation.code");
1832      else if (Configuration.doAutoCreate())
1833        this.code = new CodeableConcept(); // cc
1834    return this.code;
1835  }
1836
1837  public boolean hasCode() {
1838    return this.code != null && !this.code.isEmpty();
1839  }
1840
1841  /**
1842   * @param value {@link #code} (Describes what was observed. Sometimes this is
1843   *              called the observation "name".)
1844   */
1845  public Observation setCode(CodeableConcept value) {
1846    this.code = value;
1847    return this;
1848  }
1849
1850  /**
1851   * @return {@link #subject} (The patient, or group of patients, location, or
1852   *         device whose characteristics (direct or indirect) are described by
1853   *         the observation and into whose record the observation is placed.
1854   *         Comments: Indirect characteristics may be those of a specimen, fetus,
1855   *         donor, other observer (for example a relative or EMT), or any
1856   *         observation made about the subject.)
1857   */
1858  public Reference getSubject() {
1859    if (this.subject == null)
1860      if (Configuration.errorOnAutoCreate())
1861        throw new Error("Attempt to auto-create Observation.subject");
1862      else if (Configuration.doAutoCreate())
1863        this.subject = new Reference(); // cc
1864    return this.subject;
1865  }
1866
1867  public boolean hasSubject() {
1868    return this.subject != null && !this.subject.isEmpty();
1869  }
1870
1871  /**
1872   * @param value {@link #subject} (The patient, or group of patients, location,
1873   *              or device whose characteristics (direct or indirect) are
1874   *              described by the observation and into whose record the
1875   *              observation is placed. Comments: Indirect characteristics may be
1876   *              those of a specimen, fetus, donor, other observer (for example a
1877   *              relative or EMT), or any observation made about the subject.)
1878   */
1879  public Observation setSubject(Reference value) {
1880    this.subject = value;
1881    return this;
1882  }
1883
1884  /**
1885   * @return {@link #subject} The actual object that is the target of the
1886   *         reference. The reference library doesn't populate this, but you can
1887   *         use it to hold the resource if you resolve it. (The patient, or group
1888   *         of patients, location, or device whose characteristics (direct or
1889   *         indirect) are described by the observation and into whose record the
1890   *         observation is placed. Comments: Indirect characteristics may be
1891   *         those of a specimen, fetus, donor, other observer (for example a
1892   *         relative or EMT), or any observation made about the subject.)
1893   */
1894  public Resource getSubjectTarget() {
1895    return this.subjectTarget;
1896  }
1897
1898  /**
1899   * @param value {@link #subject} The actual object that is the target of the
1900   *              reference. The reference library doesn't use these, but you can
1901   *              use it to hold the resource if you resolve it. (The patient, or
1902   *              group of patients, location, or device whose characteristics
1903   *              (direct or indirect) are described by the observation and into
1904   *              whose record the observation is placed. Comments: Indirect
1905   *              characteristics may be those of a specimen, fetus, donor, other
1906   *              observer (for example a relative or EMT), or any observation
1907   *              made about the subject.)
1908   */
1909  public Observation setSubjectTarget(Resource value) {
1910    this.subjectTarget = value;
1911    return this;
1912  }
1913
1914  /**
1915   * @return {@link #encounter} (The healthcare event (e.g. a patient and
1916   *         healthcare provider interaction) during which this observation is
1917   *         made.)
1918   */
1919  public Reference getEncounter() {
1920    if (this.encounter == null)
1921      if (Configuration.errorOnAutoCreate())
1922        throw new Error("Attempt to auto-create Observation.encounter");
1923      else if (Configuration.doAutoCreate())
1924        this.encounter = new Reference(); // cc
1925    return this.encounter;
1926  }
1927
1928  public boolean hasEncounter() {
1929    return this.encounter != null && !this.encounter.isEmpty();
1930  }
1931
1932  /**
1933   * @param value {@link #encounter} (The healthcare event (e.g. a patient and
1934   *              healthcare provider interaction) during which this observation
1935   *              is made.)
1936   */
1937  public Observation setEncounter(Reference value) {
1938    this.encounter = value;
1939    return this;
1940  }
1941
1942  /**
1943   * @return {@link #encounter} The actual object that is the target of the
1944   *         reference. The reference library doesn't populate this, but you can
1945   *         use it to hold the resource if you resolve it. (The healthcare event
1946   *         (e.g. a patient and healthcare provider interaction) during which
1947   *         this observation is made.)
1948   */
1949  public Encounter getEncounterTarget() {
1950    if (this.encounterTarget == null)
1951      if (Configuration.errorOnAutoCreate())
1952        throw new Error("Attempt to auto-create Observation.encounter");
1953      else if (Configuration.doAutoCreate())
1954        this.encounterTarget = new Encounter(); // aa
1955    return this.encounterTarget;
1956  }
1957
1958  /**
1959   * @param value {@link #encounter} The actual object that is the target of the
1960   *              reference. The reference library doesn't use these, but you can
1961   *              use it to hold the resource if you resolve it. (The healthcare
1962   *              event (e.g. a patient and healthcare provider interaction)
1963   *              during which this observation is made.)
1964   */
1965  public Observation setEncounterTarget(Encounter value) {
1966    this.encounterTarget = value;
1967    return this;
1968  }
1969
1970  /**
1971   * @return {@link #effective} (The time or time-period the observed value is
1972   *         asserted as being true. For biological subjects - e.g. human patients
1973   *         - this is usually called the "physiologically relevant time". This is
1974   *         usually either the time of the procedure or of specimen collection,
1975   *         but very often the source of the date/time is not known, only the
1976   *         date/time itself.)
1977   */
1978  public Type getEffective() {
1979    return this.effective;
1980  }
1981
1982  /**
1983   * @return {@link #effective} (The time or time-period the observed value is
1984   *         asserted as being true. For biological subjects - e.g. human patients
1985   *         - this is usually called the "physiologically relevant time". This is
1986   *         usually either the time of the procedure or of specimen collection,
1987   *         but very often the source of the date/time is not known, only the
1988   *         date/time itself.)
1989   */
1990  public DateTimeType getEffectiveDateTimeType() throws FHIRException {
1991    if (!(this.effective instanceof DateTimeType))
1992      throw new FHIRException("Type mismatch: the type DateTimeType was expected, but "
1993          + this.effective.getClass().getName() + " was encountered");
1994    return (DateTimeType) this.effective;
1995  }
1996
1997  public boolean hasEffectiveDateTimeType() {
1998    return this.effective instanceof DateTimeType;
1999  }
2000
2001  /**
2002   * @return {@link #effective} (The time or time-period the observed value is
2003   *         asserted as being true. For biological subjects - e.g. human patients
2004   *         - this is usually called the "physiologically relevant time". This is
2005   *         usually either the time of the procedure or of specimen collection,
2006   *         but very often the source of the date/time is not known, only the
2007   *         date/time itself.)
2008   */
2009  public Period getEffectivePeriod() throws FHIRException {
2010    if (!(this.effective instanceof Period))
2011      throw new FHIRException("Type mismatch: the type Period was expected, but " + this.effective.getClass().getName()
2012          + " was encountered");
2013    return (Period) this.effective;
2014  }
2015
2016  public boolean hasEffectivePeriod() {
2017    return this.effective instanceof Period;
2018  }
2019
2020  public boolean hasEffective() {
2021    return this.effective != null && !this.effective.isEmpty();
2022  }
2023
2024  /**
2025   * @param value {@link #effective} (The time or time-period the observed value
2026   *              is asserted as being true. For biological subjects - e.g. human
2027   *              patients - this is usually called the "physiologically relevant
2028   *              time". This is usually either the time of the procedure or of
2029   *              specimen collection, but very often the source of the date/time
2030   *              is not known, only the date/time itself.)
2031   */
2032  public Observation setEffective(Type value) {
2033    this.effective = value;
2034    return this;
2035  }
2036
2037  /**
2038   * @return {@link #issued} (The date and time this observation was made
2039   *         available to providers, typically after the results have been
2040   *         reviewed and verified.). This is the underlying object with id, value
2041   *         and extensions. The accessor "getIssued" gives direct access to the
2042   *         value
2043   */
2044  public InstantType getIssuedElement() {
2045    if (this.issued == null)
2046      if (Configuration.errorOnAutoCreate())
2047        throw new Error("Attempt to auto-create Observation.issued");
2048      else if (Configuration.doAutoCreate())
2049        this.issued = new InstantType(); // bb
2050    return this.issued;
2051  }
2052
2053  public boolean hasIssuedElement() {
2054    return this.issued != null && !this.issued.isEmpty();
2055  }
2056
2057  public boolean hasIssued() {
2058    return this.issued != null && !this.issued.isEmpty();
2059  }
2060
2061  /**
2062   * @param value {@link #issued} (The date and time this observation was made
2063   *              available to providers, typically after the results have been
2064   *              reviewed and verified.). This is the underlying object with id,
2065   *              value and extensions. The accessor "getIssued" gives direct
2066   *              access to the value
2067   */
2068  public Observation setIssuedElement(InstantType value) {
2069    this.issued = value;
2070    return this;
2071  }
2072
2073  /**
2074   * @return The date and time this observation was made available to providers,
2075   *         typically after the results have been reviewed and verified.
2076   */
2077  public Date getIssued() {
2078    return this.issued == null ? null : this.issued.getValue();
2079  }
2080
2081  /**
2082   * @param value The date and time this observation was made available to
2083   *              providers, typically after the results have been reviewed and
2084   *              verified.
2085   */
2086  public Observation setIssued(Date value) {
2087    if (value == null)
2088      this.issued = null;
2089    else {
2090      if (this.issued == null)
2091        this.issued = new InstantType();
2092      this.issued.setValue(value);
2093    }
2094    return this;
2095  }
2096
2097  /**
2098   * @return {@link #performer} (Who was responsible for asserting the observed
2099   *         value as "true".)
2100   */
2101  public List<Reference> getPerformer() {
2102    if (this.performer == null)
2103      this.performer = new ArrayList<Reference>();
2104    return this.performer;
2105  }
2106
2107  public boolean hasPerformer() {
2108    if (this.performer == null)
2109      return false;
2110    for (Reference item : this.performer)
2111      if (!item.isEmpty())
2112        return true;
2113    return false;
2114  }
2115
2116  /**
2117   * @return {@link #performer} (Who was responsible for asserting the observed
2118   *         value as "true".)
2119   */
2120  // syntactic sugar
2121  public Reference addPerformer() { // 3
2122    Reference t = new Reference();
2123    if (this.performer == null)
2124      this.performer = new ArrayList<Reference>();
2125    this.performer.add(t);
2126    return t;
2127  }
2128
2129  // syntactic sugar
2130  public Observation addPerformer(Reference t) { // 3
2131    if (t == null)
2132      return this;
2133    if (this.performer == null)
2134      this.performer = new ArrayList<Reference>();
2135    this.performer.add(t);
2136    return this;
2137  }
2138
2139  /**
2140   * @return {@link #performer} (The actual objects that are the target of the
2141   *         reference. The reference library doesn't populate this, but you can
2142   *         use this to hold the resources if you resolvethemt. Who was
2143   *         responsible for asserting the observed value as "true".)
2144   */
2145  public List<Resource> getPerformerTarget() {
2146    if (this.performerTarget == null)
2147      this.performerTarget = new ArrayList<Resource>();
2148    return this.performerTarget;
2149  }
2150
2151  /**
2152   * @return {@link #value} (The information determined as a result of making the
2153   *         observation, if the information has a simple value.)
2154   */
2155  public Type getValue() {
2156    return this.value;
2157  }
2158
2159  /**
2160   * @return {@link #value} (The information determined as a result of making the
2161   *         observation, if the information has a simple value.)
2162   */
2163  public Quantity getValueQuantity() throws FHIRException {
2164    if (!(this.value instanceof Quantity))
2165      throw new FHIRException(
2166          "Type mismatch: the type Quantity was expected, but " + this.value.getClass().getName() + " was encountered");
2167    return (Quantity) this.value;
2168  }
2169
2170  public boolean hasValueQuantity() {
2171    return this.value instanceof Quantity;
2172  }
2173
2174  /**
2175   * @return {@link #value} (The information determined as a result of making the
2176   *         observation, if the information has a simple value.)
2177   */
2178  public CodeableConcept getValueCodeableConcept() throws FHIRException {
2179    if (!(this.value instanceof CodeableConcept))
2180      throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "
2181          + this.value.getClass().getName() + " was encountered");
2182    return (CodeableConcept) this.value;
2183  }
2184
2185  public boolean hasValueCodeableConcept() {
2186    return this.value instanceof CodeableConcept;
2187  }
2188
2189  /**
2190   * @return {@link #value} (The information determined as a result of making the
2191   *         observation, if the information has a simple value.)
2192   */
2193  public StringType getValueStringType() throws FHIRException {
2194    if (!(this.value instanceof StringType))
2195      throw new FHIRException("Type mismatch: the type StringType was expected, but " + this.value.getClass().getName()
2196          + " was encountered");
2197    return (StringType) this.value;
2198  }
2199
2200  public boolean hasValueStringType() {
2201    return this.value instanceof StringType;
2202  }
2203
2204  /**
2205   * @return {@link #value} (The information determined as a result of making the
2206   *         observation, if the information has a simple value.)
2207   */
2208  public Range getValueRange() throws FHIRException {
2209    if (!(this.value instanceof Range))
2210      throw new FHIRException(
2211          "Type mismatch: the type Range was expected, but " + this.value.getClass().getName() + " was encountered");
2212    return (Range) this.value;
2213  }
2214
2215  public boolean hasValueRange() {
2216    return this.value instanceof Range;
2217  }
2218
2219  /**
2220   * @return {@link #value} (The information determined as a result of making the
2221   *         observation, if the information has a simple value.)
2222   */
2223  public Ratio getValueRatio() throws FHIRException {
2224    if (!(this.value instanceof Ratio))
2225      throw new FHIRException(
2226          "Type mismatch: the type Ratio was expected, but " + this.value.getClass().getName() + " was encountered");
2227    return (Ratio) this.value;
2228  }
2229
2230  public boolean hasValueRatio() {
2231    return this.value instanceof Ratio;
2232  }
2233
2234  /**
2235   * @return {@link #value} (The information determined as a result of making the
2236   *         observation, if the information has a simple value.)
2237   */
2238  public SampledData getValueSampledData() throws FHIRException {
2239    if (!(this.value instanceof SampledData))
2240      throw new FHIRException("Type mismatch: the type SampledData was expected, but " + this.value.getClass().getName()
2241          + " was encountered");
2242    return (SampledData) this.value;
2243  }
2244
2245  public boolean hasValueSampledData() {
2246    return this.value instanceof SampledData;
2247  }
2248
2249  /**
2250   * @return {@link #value} (The information determined as a result of making the
2251   *         observation, if the information has a simple value.)
2252   */
2253  public Attachment getValueAttachment() throws FHIRException {
2254    if (!(this.value instanceof Attachment))
2255      throw new FHIRException("Type mismatch: the type Attachment was expected, but " + this.value.getClass().getName()
2256          + " was encountered");
2257    return (Attachment) this.value;
2258  }
2259
2260  public boolean hasValueAttachment() {
2261    return this.value instanceof Attachment;
2262  }
2263
2264  /**
2265   * @return {@link #value} (The information determined as a result of making the
2266   *         observation, if the information has a simple value.)
2267   */
2268  public TimeType getValueTimeType() throws FHIRException {
2269    if (!(this.value instanceof TimeType))
2270      throw new FHIRException(
2271          "Type mismatch: the type TimeType was expected, but " + this.value.getClass().getName() + " was encountered");
2272    return (TimeType) this.value;
2273  }
2274
2275  public boolean hasValueTimeType() {
2276    return this.value instanceof TimeType;
2277  }
2278
2279  /**
2280   * @return {@link #value} (The information determined as a result of making the
2281   *         observation, if the information has a simple value.)
2282   */
2283  public DateTimeType getValueDateTimeType() throws FHIRException {
2284    if (!(this.value instanceof DateTimeType))
2285      throw new FHIRException("Type mismatch: the type DateTimeType was expected, but "
2286          + this.value.getClass().getName() + " was encountered");
2287    return (DateTimeType) this.value;
2288  }
2289
2290  public boolean hasValueDateTimeType() {
2291    return this.value instanceof DateTimeType;
2292  }
2293
2294  /**
2295   * @return {@link #value} (The information determined as a result of making the
2296   *         observation, if the information has a simple value.)
2297   */
2298  public Period getValuePeriod() throws FHIRException {
2299    if (!(this.value instanceof Period))
2300      throw new FHIRException(
2301          "Type mismatch: the type Period was expected, but " + this.value.getClass().getName() + " was encountered");
2302    return (Period) this.value;
2303  }
2304
2305  public boolean hasValuePeriod() {
2306    return this.value instanceof Period;
2307  }
2308
2309  public boolean hasValue() {
2310    return this.value != null && !this.value.isEmpty();
2311  }
2312
2313  /**
2314   * @param value {@link #value} (The information determined as a result of making
2315   *              the observation, if the information has a simple value.)
2316   */
2317  public Observation setValue(Type value) {
2318    this.value = value;
2319    return this;
2320  }
2321
2322  /**
2323   * @return {@link #dataAbsentReason} (Provides a reason why the expected value
2324   *         in the element Observation.value[x] is missing.)
2325   */
2326  public CodeableConcept getDataAbsentReason() {
2327    if (this.dataAbsentReason == null)
2328      if (Configuration.errorOnAutoCreate())
2329        throw new Error("Attempt to auto-create Observation.dataAbsentReason");
2330      else if (Configuration.doAutoCreate())
2331        this.dataAbsentReason = new CodeableConcept(); // cc
2332    return this.dataAbsentReason;
2333  }
2334
2335  public boolean hasDataAbsentReason() {
2336    return this.dataAbsentReason != null && !this.dataAbsentReason.isEmpty();
2337  }
2338
2339  /**
2340   * @param value {@link #dataAbsentReason} (Provides a reason why the expected
2341   *              value in the element Observation.value[x] is missing.)
2342   */
2343  public Observation setDataAbsentReason(CodeableConcept value) {
2344    this.dataAbsentReason = value;
2345    return this;
2346  }
2347
2348  /**
2349   * @return {@link #interpretation} (The assessment made based on the result of
2350   *         the observation. Intended as a simple compact code often placed
2351   *         adjacent to the result value in reports and flow sheets to signal the
2352   *         meaning/normalcy status of the result. Otherwise known as abnormal
2353   *         flag.)
2354   */
2355  public CodeableConcept getInterpretation() {
2356    if (this.interpretation == null)
2357      if (Configuration.errorOnAutoCreate())
2358        throw new Error("Attempt to auto-create Observation.interpretation");
2359      else if (Configuration.doAutoCreate())
2360        this.interpretation = new CodeableConcept(); // cc
2361    return this.interpretation;
2362  }
2363
2364  public boolean hasInterpretation() {
2365    return this.interpretation != null && !this.interpretation.isEmpty();
2366  }
2367
2368  /**
2369   * @param value {@link #interpretation} (The assessment made based on the result
2370   *              of the observation. Intended as a simple compact code often
2371   *              placed adjacent to the result value in reports and flow sheets
2372   *              to signal the meaning/normalcy status of the result. Otherwise
2373   *              known as abnormal flag.)
2374   */
2375  public Observation setInterpretation(CodeableConcept value) {
2376    this.interpretation = value;
2377    return this;
2378  }
2379
2380  /**
2381   * @return {@link #comments} (May include statements about significant,
2382   *         unexpected or unreliable values, or information about the source of
2383   *         the value where this may be relevant to the interpretation of the
2384   *         result.). This is the underlying object with id, value and
2385   *         extensions. The accessor "getComments" gives direct access to the
2386   *         value
2387   */
2388  public StringType getCommentsElement() {
2389    if (this.comments == null)
2390      if (Configuration.errorOnAutoCreate())
2391        throw new Error("Attempt to auto-create Observation.comments");
2392      else if (Configuration.doAutoCreate())
2393        this.comments = new StringType(); // bb
2394    return this.comments;
2395  }
2396
2397  public boolean hasCommentsElement() {
2398    return this.comments != null && !this.comments.isEmpty();
2399  }
2400
2401  public boolean hasComments() {
2402    return this.comments != null && !this.comments.isEmpty();
2403  }
2404
2405  /**
2406   * @param value {@link #comments} (May include statements about significant,
2407   *              unexpected or unreliable values, or information about the source
2408   *              of the value where this may be relevant to the interpretation of
2409   *              the result.). This is the underlying object with id, value and
2410   *              extensions. The accessor "getComments" gives direct access to
2411   *              the value
2412   */
2413  public Observation setCommentsElement(StringType value) {
2414    this.comments = value;
2415    return this;
2416  }
2417
2418  /**
2419   * @return May include statements about significant, unexpected or unreliable
2420   *         values, or information about the source of the value where this may
2421   *         be relevant to the interpretation of the result.
2422   */
2423  public String getComments() {
2424    return this.comments == null ? null : this.comments.getValue();
2425  }
2426
2427  /**
2428   * @param value May include statements about significant, unexpected or
2429   *              unreliable values, or information about the source of the value
2430   *              where this may be relevant to the interpretation of the result.
2431   */
2432  public Observation setComments(String value) {
2433    if (Utilities.noString(value))
2434      this.comments = null;
2435    else {
2436      if (this.comments == null)
2437        this.comments = new StringType();
2438      this.comments.setValue(value);
2439    }
2440    return this;
2441  }
2442
2443  /**
2444   * @return {@link #bodySite} (Indicates the site on the subject's body where the
2445   *         observation was made (i.e. the target site).)
2446   */
2447  public CodeableConcept getBodySite() {
2448    if (this.bodySite == null)
2449      if (Configuration.errorOnAutoCreate())
2450        throw new Error("Attempt to auto-create Observation.bodySite");
2451      else if (Configuration.doAutoCreate())
2452        this.bodySite = new CodeableConcept(); // cc
2453    return this.bodySite;
2454  }
2455
2456  public boolean hasBodySite() {
2457    return this.bodySite != null && !this.bodySite.isEmpty();
2458  }
2459
2460  /**
2461   * @param value {@link #bodySite} (Indicates the site on the subject's body
2462   *              where the observation was made (i.e. the target site).)
2463   */
2464  public Observation setBodySite(CodeableConcept value) {
2465    this.bodySite = value;
2466    return this;
2467  }
2468
2469  /**
2470   * @return {@link #method} (Indicates the mechanism used to perform the
2471   *         observation.)
2472   */
2473  public CodeableConcept getMethod() {
2474    if (this.method == null)
2475      if (Configuration.errorOnAutoCreate())
2476        throw new Error("Attempt to auto-create Observation.method");
2477      else if (Configuration.doAutoCreate())
2478        this.method = new CodeableConcept(); // cc
2479    return this.method;
2480  }
2481
2482  public boolean hasMethod() {
2483    return this.method != null && !this.method.isEmpty();
2484  }
2485
2486  /**
2487   * @param value {@link #method} (Indicates the mechanism used to perform the
2488   *              observation.)
2489   */
2490  public Observation setMethod(CodeableConcept value) {
2491    this.method = value;
2492    return this;
2493  }
2494
2495  /**
2496   * @return {@link #specimen} (The specimen that was used when this observation
2497   *         was made.)
2498   */
2499  public Reference getSpecimen() {
2500    if (this.specimen == null)
2501      if (Configuration.errorOnAutoCreate())
2502        throw new Error("Attempt to auto-create Observation.specimen");
2503      else if (Configuration.doAutoCreate())
2504        this.specimen = new Reference(); // cc
2505    return this.specimen;
2506  }
2507
2508  public boolean hasSpecimen() {
2509    return this.specimen != null && !this.specimen.isEmpty();
2510  }
2511
2512  /**
2513   * @param value {@link #specimen} (The specimen that was used when this
2514   *              observation was made.)
2515   */
2516  public Observation setSpecimen(Reference value) {
2517    this.specimen = value;
2518    return this;
2519  }
2520
2521  /**
2522   * @return {@link #specimen} The actual object that is the target of the
2523   *         reference. The reference library doesn't populate this, but you can
2524   *         use it to hold the resource if you resolve it. (The specimen that was
2525   *         used when this observation was made.)
2526   */
2527  public Specimen getSpecimenTarget() {
2528    if (this.specimenTarget == null)
2529      if (Configuration.errorOnAutoCreate())
2530        throw new Error("Attempt to auto-create Observation.specimen");
2531      else if (Configuration.doAutoCreate())
2532        this.specimenTarget = new Specimen(); // aa
2533    return this.specimenTarget;
2534  }
2535
2536  /**
2537   * @param value {@link #specimen} The actual object that is the target of the
2538   *              reference. The reference library doesn't use these, but you can
2539   *              use it to hold the resource if you resolve it. (The specimen
2540   *              that was used when this observation was made.)
2541   */
2542  public Observation setSpecimenTarget(Specimen value) {
2543    this.specimenTarget = value;
2544    return this;
2545  }
2546
2547  /**
2548   * @return {@link #device} (The device used to generate the observation data.)
2549   */
2550  public Reference getDevice() {
2551    if (this.device == null)
2552      if (Configuration.errorOnAutoCreate())
2553        throw new Error("Attempt to auto-create Observation.device");
2554      else if (Configuration.doAutoCreate())
2555        this.device = new Reference(); // cc
2556    return this.device;
2557  }
2558
2559  public boolean hasDevice() {
2560    return this.device != null && !this.device.isEmpty();
2561  }
2562
2563  /**
2564   * @param value {@link #device} (The device used to generate the observation
2565   *              data.)
2566   */
2567  public Observation setDevice(Reference value) {
2568    this.device = value;
2569    return this;
2570  }
2571
2572  /**
2573   * @return {@link #device} The actual object that is the target of the
2574   *         reference. The reference library doesn't populate this, but you can
2575   *         use it to hold the resource if you resolve it. (The device used to
2576   *         generate the observation data.)
2577   */
2578  public Resource getDeviceTarget() {
2579    return this.deviceTarget;
2580  }
2581
2582  /**
2583   * @param value {@link #device} The actual object that is the target of the
2584   *              reference. The reference library doesn't use these, but you can
2585   *              use it to hold the resource if you resolve it. (The device used
2586   *              to generate the observation data.)
2587   */
2588  public Observation setDeviceTarget(Resource value) {
2589    this.deviceTarget = value;
2590    return this;
2591  }
2592
2593  /**
2594   * @return {@link #referenceRange} (Guidance on how to interpret the value by
2595   *         comparison to a normal or recommended range.)
2596   */
2597  public List<ObservationReferenceRangeComponent> getReferenceRange() {
2598    if (this.referenceRange == null)
2599      this.referenceRange = new ArrayList<ObservationReferenceRangeComponent>();
2600    return this.referenceRange;
2601  }
2602
2603  public boolean hasReferenceRange() {
2604    if (this.referenceRange == null)
2605      return false;
2606    for (ObservationReferenceRangeComponent item : this.referenceRange)
2607      if (!item.isEmpty())
2608        return true;
2609    return false;
2610  }
2611
2612  /**
2613   * @return {@link #referenceRange} (Guidance on how to interpret the value by
2614   *         comparison to a normal or recommended range.)
2615   */
2616  // syntactic sugar
2617  public ObservationReferenceRangeComponent addReferenceRange() { // 3
2618    ObservationReferenceRangeComponent t = new ObservationReferenceRangeComponent();
2619    if (this.referenceRange == null)
2620      this.referenceRange = new ArrayList<ObservationReferenceRangeComponent>();
2621    this.referenceRange.add(t);
2622    return t;
2623  }
2624
2625  // syntactic sugar
2626  public Observation addReferenceRange(ObservationReferenceRangeComponent t) { // 3
2627    if (t == null)
2628      return this;
2629    if (this.referenceRange == null)
2630      this.referenceRange = new ArrayList<ObservationReferenceRangeComponent>();
2631    this.referenceRange.add(t);
2632    return this;
2633  }
2634
2635  /**
2636   * @return {@link #related} (A reference to another resource (usually another
2637   *         Observation but could also be a QuestionnaireAnswer) whose
2638   *         relationship is defined by the relationship type code.)
2639   */
2640  public List<ObservationRelatedComponent> getRelated() {
2641    if (this.related == null)
2642      this.related = new ArrayList<ObservationRelatedComponent>();
2643    return this.related;
2644  }
2645
2646  public boolean hasRelated() {
2647    if (this.related == null)
2648      return false;
2649    for (ObservationRelatedComponent item : this.related)
2650      if (!item.isEmpty())
2651        return true;
2652    return false;
2653  }
2654
2655  /**
2656   * @return {@link #related} (A reference to another resource (usually another
2657   *         Observation but could also be a QuestionnaireAnswer) whose
2658   *         relationship is defined by the relationship type code.)
2659   */
2660  // syntactic sugar
2661  public ObservationRelatedComponent addRelated() { // 3
2662    ObservationRelatedComponent t = new ObservationRelatedComponent();
2663    if (this.related == null)
2664      this.related = new ArrayList<ObservationRelatedComponent>();
2665    this.related.add(t);
2666    return t;
2667  }
2668
2669  // syntactic sugar
2670  public Observation addRelated(ObservationRelatedComponent t) { // 3
2671    if (t == null)
2672      return this;
2673    if (this.related == null)
2674      this.related = new ArrayList<ObservationRelatedComponent>();
2675    this.related.add(t);
2676    return this;
2677  }
2678
2679  /**
2680   * @return {@link #component} (Some observations have multiple component
2681   *         observations. These component observations are expressed as separate
2682   *         code value pairs that share the same attributes. Examples include
2683   *         systolic and diastolic component observations for blood pressure
2684   *         measurement and multiple component observations for genetics
2685   *         observations.)
2686   */
2687  public List<ObservationComponentComponent> getComponent() {
2688    if (this.component == null)
2689      this.component = new ArrayList<ObservationComponentComponent>();
2690    return this.component;
2691  }
2692
2693  public boolean hasComponent() {
2694    if (this.component == null)
2695      return false;
2696    for (ObservationComponentComponent item : this.component)
2697      if (!item.isEmpty())
2698        return true;
2699    return false;
2700  }
2701
2702  /**
2703   * @return {@link #component} (Some observations have multiple component
2704   *         observations. These component observations are expressed as separate
2705   *         code value pairs that share the same attributes. Examples include
2706   *         systolic and diastolic component observations for blood pressure
2707   *         measurement and multiple component observations for genetics
2708   *         observations.)
2709   */
2710  // syntactic sugar
2711  public ObservationComponentComponent addComponent() { // 3
2712    ObservationComponentComponent t = new ObservationComponentComponent();
2713    if (this.component == null)
2714      this.component = new ArrayList<ObservationComponentComponent>();
2715    this.component.add(t);
2716    return t;
2717  }
2718
2719  // syntactic sugar
2720  public Observation addComponent(ObservationComponentComponent t) { // 3
2721    if (t == null)
2722      return this;
2723    if (this.component == null)
2724      this.component = new ArrayList<ObservationComponentComponent>();
2725    this.component.add(t);
2726    return this;
2727  }
2728
2729  protected void listChildren(List<Property> childrenList) {
2730    super.listChildren(childrenList);
2731    childrenList.add(new Property("identifier", "Identifier",
2732        "A unique identifier for the simple observation instance.", 0, java.lang.Integer.MAX_VALUE, identifier));
2733    childrenList
2734        .add(new Property("status", "code", "The status of the result value.", 0, java.lang.Integer.MAX_VALUE, status));
2735    childrenList.add(new Property("category", "CodeableConcept",
2736        "A code that classifies the general type of observation being made.  This is used  for searching, sorting and display purposes.",
2737        0, java.lang.Integer.MAX_VALUE, category));
2738    childrenList.add(new Property("code", "CodeableConcept",
2739        "Describes what was observed. Sometimes this is called the observation \"name\".", 0,
2740        java.lang.Integer.MAX_VALUE, code));
2741    childrenList.add(new Property("subject", "Reference(Patient|Group|Device|Location)",
2742        "The patient, or group of patients, location, or device whose characteristics (direct or indirect) are described by the observation and into whose record the observation is placed.  Comments: Indirect characteristics may be those of a specimen, fetus, donor,  other observer (for example a relative or EMT), or any observation made about the subject.",
2743        0, java.lang.Integer.MAX_VALUE, subject));
2744    childrenList.add(new Property("encounter", "Reference(Encounter)",
2745        "The healthcare event  (e.g. a patient and healthcare provider interaction) during which this observation is made.",
2746        0, java.lang.Integer.MAX_VALUE, encounter));
2747    childrenList.add(new Property("effective[x]", "dateTime|Period",
2748        "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.",
2749        0, java.lang.Integer.MAX_VALUE, effective));
2750    childrenList.add(new Property("issued", "instant",
2751        "The date and time this observation was made available to providers, typically after the results have been reviewed and verified.",
2752        0, java.lang.Integer.MAX_VALUE, issued));
2753    childrenList.add(new Property("performer", "Reference(Practitioner|Organization|Patient|RelatedPerson)",
2754        "Who was responsible for asserting the observed value as \"true\".", 0, java.lang.Integer.MAX_VALUE,
2755        performer));
2756    childrenList.add(new Property("value[x]",
2757        "Quantity|CodeableConcept|string|Range|Ratio|SampledData|Attachment|time|dateTime|Period",
2758        "The information determined as a result of making the observation, if the information has a simple value.", 0,
2759        java.lang.Integer.MAX_VALUE, value));
2760    childrenList.add(new Property("dataAbsentReason", "CodeableConcept",
2761        "Provides a reason why the expected value in the element Observation.value[x] is missing.", 0,
2762        java.lang.Integer.MAX_VALUE, dataAbsentReason));
2763    childrenList.add(new Property("interpretation", "CodeableConcept",
2764        "The assessment made based on the result of the observation.  Intended as a simple compact code often placed adjacent to the result value in reports and flow sheets to signal the meaning/normalcy status of the result. Otherwise known as abnormal flag.",
2765        0, java.lang.Integer.MAX_VALUE, interpretation));
2766    childrenList.add(new Property("comments", "string",
2767        "May include statements about significant, unexpected or unreliable values, or information about the source of the value where this may be relevant to the interpretation of the result.",
2768        0, java.lang.Integer.MAX_VALUE, comments));
2769    childrenList.add(new Property("bodySite", "CodeableConcept",
2770        "Indicates the site on the subject's body where the observation was made (i.e. the target site).", 0,
2771        java.lang.Integer.MAX_VALUE, bodySite));
2772    childrenList.add(new Property("method", "CodeableConcept",
2773        "Indicates the mechanism used to perform the observation.", 0, java.lang.Integer.MAX_VALUE, method));
2774    childrenList.add(new Property("specimen", "Reference(Specimen)",
2775        "The specimen that was used when this observation was made.", 0, java.lang.Integer.MAX_VALUE, specimen));
2776    childrenList.add(new Property("device", "Reference(Device|DeviceMetric)",
2777        "The device used to generate the observation data.", 0, java.lang.Integer.MAX_VALUE, device));
2778    childrenList.add(new Property("referenceRange", "",
2779        "Guidance on how to interpret the value by comparison to a normal or recommended range.", 0,
2780        java.lang.Integer.MAX_VALUE, referenceRange));
2781    childrenList.add(new Property("related", "",
2782        "A  reference to another resource (usually another Observation but could  also be a QuestionnaireAnswer) whose relationship is defined by the relationship type code.",
2783        0, java.lang.Integer.MAX_VALUE, related));
2784    childrenList.add(new Property("component", "",
2785        "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.",
2786        0, java.lang.Integer.MAX_VALUE, component));
2787  }
2788
2789  @Override
2790  public void setProperty(String name, Base value) throws FHIRException {
2791    if (name.equals("identifier"))
2792      this.getIdentifier().add(castToIdentifier(value));
2793    else if (name.equals("status"))
2794      this.status = new ObservationStatusEnumFactory().fromType(value); // Enumeration<ObservationStatus>
2795    else if (name.equals("category"))
2796      this.category = castToCodeableConcept(value); // CodeableConcept
2797    else if (name.equals("code"))
2798      this.code = castToCodeableConcept(value); // CodeableConcept
2799    else if (name.equals("subject"))
2800      this.subject = castToReference(value); // Reference
2801    else if (name.equals("encounter"))
2802      this.encounter = castToReference(value); // Reference
2803    else if (name.equals("effective[x]"))
2804      this.effective = (Type) value; // Type
2805    else if (name.equals("issued"))
2806      this.issued = castToInstant(value); // InstantType
2807    else if (name.equals("performer"))
2808      this.getPerformer().add(castToReference(value));
2809    else if (name.equals("value[x]"))
2810      this.value = (Type) value; // Type
2811    else if (name.equals("dataAbsentReason"))
2812      this.dataAbsentReason = castToCodeableConcept(value); // CodeableConcept
2813    else if (name.equals("interpretation"))
2814      this.interpretation = castToCodeableConcept(value); // CodeableConcept
2815    else if (name.equals("comments"))
2816      this.comments = castToString(value); // StringType
2817    else if (name.equals("bodySite"))
2818      this.bodySite = castToCodeableConcept(value); // CodeableConcept
2819    else if (name.equals("method"))
2820      this.method = castToCodeableConcept(value); // CodeableConcept
2821    else if (name.equals("specimen"))
2822      this.specimen = castToReference(value); // Reference
2823    else if (name.equals("device"))
2824      this.device = castToReference(value); // Reference
2825    else if (name.equals("referenceRange"))
2826      this.getReferenceRange().add((ObservationReferenceRangeComponent) value);
2827    else if (name.equals("related"))
2828      this.getRelated().add((ObservationRelatedComponent) value);
2829    else if (name.equals("component"))
2830      this.getComponent().add((ObservationComponentComponent) value);
2831    else
2832      super.setProperty(name, value);
2833  }
2834
2835  @Override
2836  public Base addChild(String name) throws FHIRException {
2837    if (name.equals("identifier")) {
2838      return addIdentifier();
2839    } else if (name.equals("status")) {
2840      throw new FHIRException("Cannot call addChild on a singleton property Observation.status");
2841    } else if (name.equals("category")) {
2842      this.category = new CodeableConcept();
2843      return this.category;
2844    } else if (name.equals("code")) {
2845      this.code = new CodeableConcept();
2846      return this.code;
2847    } else if (name.equals("subject")) {
2848      this.subject = new Reference();
2849      return this.subject;
2850    } else if (name.equals("encounter")) {
2851      this.encounter = new Reference();
2852      return this.encounter;
2853    } else if (name.equals("effectiveDateTime")) {
2854      this.effective = new DateTimeType();
2855      return this.effective;
2856    } else if (name.equals("effectivePeriod")) {
2857      this.effective = new Period();
2858      return this.effective;
2859    } else if (name.equals("issued")) {
2860      throw new FHIRException("Cannot call addChild on a singleton property Observation.issued");
2861    } else if (name.equals("performer")) {
2862      return addPerformer();
2863    } else if (name.equals("valueQuantity")) {
2864      this.value = new Quantity();
2865      return this.value;
2866    } else if (name.equals("valueCodeableConcept")) {
2867      this.value = new CodeableConcept();
2868      return this.value;
2869    } else if (name.equals("valueString")) {
2870      this.value = new StringType();
2871      return this.value;
2872    } else if (name.equals("valueRange")) {
2873      this.value = new Range();
2874      return this.value;
2875    } else if (name.equals("valueRatio")) {
2876      this.value = new Ratio();
2877      return this.value;
2878    } else if (name.equals("valueSampledData")) {
2879      this.value = new SampledData();
2880      return this.value;
2881    } else if (name.equals("valueAttachment")) {
2882      this.value = new Attachment();
2883      return this.value;
2884    } else if (name.equals("valueTime")) {
2885      this.value = new TimeType();
2886      return this.value;
2887    } else if (name.equals("valueDateTime")) {
2888      this.value = new DateTimeType();
2889      return this.value;
2890    } else if (name.equals("valuePeriod")) {
2891      this.value = new Period();
2892      return this.value;
2893    } else if (name.equals("dataAbsentReason")) {
2894      this.dataAbsentReason = new CodeableConcept();
2895      return this.dataAbsentReason;
2896    } else if (name.equals("interpretation")) {
2897      this.interpretation = new CodeableConcept();
2898      return this.interpretation;
2899    } else if (name.equals("comments")) {
2900      throw new FHIRException("Cannot call addChild on a singleton property Observation.comments");
2901    } else if (name.equals("bodySite")) {
2902      this.bodySite = new CodeableConcept();
2903      return this.bodySite;
2904    } else if (name.equals("method")) {
2905      this.method = new CodeableConcept();
2906      return this.method;
2907    } else if (name.equals("specimen")) {
2908      this.specimen = new Reference();
2909      return this.specimen;
2910    } else if (name.equals("device")) {
2911      this.device = new Reference();
2912      return this.device;
2913    } else if (name.equals("referenceRange")) {
2914      return addReferenceRange();
2915    } else if (name.equals("related")) {
2916      return addRelated();
2917    } else if (name.equals("component")) {
2918      return addComponent();
2919    } else
2920      return super.addChild(name);
2921  }
2922
2923  public String fhirType() {
2924    return "Observation";
2925
2926  }
2927
2928  public Observation copy() {
2929    Observation dst = new Observation();
2930    copyValues(dst);
2931    if (identifier != null) {
2932      dst.identifier = new ArrayList<Identifier>();
2933      for (Identifier i : identifier)
2934        dst.identifier.add(i.copy());
2935    }
2936    ;
2937    dst.status = status == null ? null : status.copy();
2938    dst.category = category == null ? null : category.copy();
2939    dst.code = code == null ? null : code.copy();
2940    dst.subject = subject == null ? null : subject.copy();
2941    dst.encounter = encounter == null ? null : encounter.copy();
2942    dst.effective = effective == null ? null : effective.copy();
2943    dst.issued = issued == null ? null : issued.copy();
2944    if (performer != null) {
2945      dst.performer = new ArrayList<Reference>();
2946      for (Reference i : performer)
2947        dst.performer.add(i.copy());
2948    }
2949    ;
2950    dst.value = value == null ? null : value.copy();
2951    dst.dataAbsentReason = dataAbsentReason == null ? null : dataAbsentReason.copy();
2952    dst.interpretation = interpretation == null ? null : interpretation.copy();
2953    dst.comments = comments == null ? null : comments.copy();
2954    dst.bodySite = bodySite == null ? null : bodySite.copy();
2955    dst.method = method == null ? null : method.copy();
2956    dst.specimen = specimen == null ? null : specimen.copy();
2957    dst.device = device == null ? null : device.copy();
2958    if (referenceRange != null) {
2959      dst.referenceRange = new ArrayList<ObservationReferenceRangeComponent>();
2960      for (ObservationReferenceRangeComponent i : referenceRange)
2961        dst.referenceRange.add(i.copy());
2962    }
2963    ;
2964    if (related != null) {
2965      dst.related = new ArrayList<ObservationRelatedComponent>();
2966      for (ObservationRelatedComponent i : related)
2967        dst.related.add(i.copy());
2968    }
2969    ;
2970    if (component != null) {
2971      dst.component = new ArrayList<ObservationComponentComponent>();
2972      for (ObservationComponentComponent i : component)
2973        dst.component.add(i.copy());
2974    }
2975    ;
2976    return dst;
2977  }
2978
2979  protected Observation typedCopy() {
2980    return copy();
2981  }
2982
2983  @Override
2984  public boolean equalsDeep(Base other) {
2985    if (!super.equalsDeep(other))
2986      return false;
2987    if (!(other instanceof Observation))
2988      return false;
2989    Observation o = (Observation) other;
2990    return compareDeep(identifier, o.identifier, true) && compareDeep(status, o.status, true)
2991        && compareDeep(category, o.category, true) && compareDeep(code, o.code, true)
2992        && compareDeep(subject, o.subject, true) && compareDeep(encounter, o.encounter, true)
2993        && compareDeep(effective, o.effective, true) && compareDeep(issued, o.issued, true)
2994        && compareDeep(performer, o.performer, true) && compareDeep(value, o.value, true)
2995        && compareDeep(dataAbsentReason, o.dataAbsentReason, true)
2996        && compareDeep(interpretation, o.interpretation, true) && compareDeep(comments, o.comments, true)
2997        && compareDeep(bodySite, o.bodySite, true) && compareDeep(method, o.method, true)
2998        && compareDeep(specimen, o.specimen, true) && compareDeep(device, o.device, true)
2999        && compareDeep(referenceRange, o.referenceRange, true) && compareDeep(related, o.related, true)
3000        && compareDeep(component, o.component, true);
3001  }
3002
3003  @Override
3004  public boolean equalsShallow(Base other) {
3005    if (!super.equalsShallow(other))
3006      return false;
3007    if (!(other instanceof Observation))
3008      return false;
3009    Observation o = (Observation) other;
3010    return compareValues(status, o.status, true) && compareValues(issued, o.issued, true)
3011        && compareValues(comments, o.comments, true);
3012  }
3013
3014  public boolean isEmpty() {
3015    return super.isEmpty() && (identifier == null || identifier.isEmpty()) && (status == null || status.isEmpty())
3016        && (category == null || category.isEmpty()) && (code == null || code.isEmpty())
3017        && (subject == null || subject.isEmpty()) && (encounter == null || encounter.isEmpty())
3018        && (effective == null || effective.isEmpty()) && (issued == null || issued.isEmpty())
3019        && (performer == null || performer.isEmpty()) && (value == null || value.isEmpty())
3020        && (dataAbsentReason == null || dataAbsentReason.isEmpty())
3021        && (interpretation == null || interpretation.isEmpty()) && (comments == null || comments.isEmpty())
3022        && (bodySite == null || bodySite.isEmpty()) && (method == null || method.isEmpty())
3023        && (specimen == null || specimen.isEmpty()) && (device == null || device.isEmpty())
3024        && (referenceRange == null || referenceRange.isEmpty()) && (related == null || related.isEmpty())
3025        && (component == null || component.isEmpty());
3026  }
3027
3028  @Override
3029  public ResourceType getResourceType() {
3030    return ResourceType.Observation;
3031  }
3032
3033  @SearchParamDefinition(name = "date", path = "Observation.effective[x]", description = "Obtained date/time. If the obtained element is a period, a date that falls in the period", type = "date")
3034  public static final String SP_DATE = "date";
3035  @SearchParamDefinition(name = "code", path = "Observation.code", description = "The code of the observation type", type = "token")
3036  public static final String SP_CODE = "code";
3037  @SearchParamDefinition(name = "subject", path = "Observation.subject", description = "The subject that the observation is about", type = "reference")
3038  public static final String SP_SUBJECT = "subject";
3039  @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")
3040  public static final String SP_COMPONENTDATAABSENTREASON = "component-data-absent-reason";
3041  @SearchParamDefinition(name = "value-concept", path = "Observation.valueCodeableConcept", description = "The value of the observation, if the value is a CodeableConcept", type = "token")
3042  public static final String SP_VALUECONCEPT = "value-concept";
3043  @SearchParamDefinition(name = "value-date", path = "Observation.valueDateTime | Observation.valuePeriod", description = "The value of the observation, if the value is a date or period of time", type = "date")
3044  public static final String SP_VALUEDATE = "value-date";
3045  @SearchParamDefinition(name = "related", path = "null", description = "Related Observations - search on related-type and related-target together", type = "composite")
3046  public static final String SP_RELATED = "related";
3047  @SearchParamDefinition(name = "patient", path = "Observation.subject", description = "The subject that the observation is about (if patient)", type = "reference")
3048  public static final String SP_PATIENT = "patient";
3049  @SearchParamDefinition(name = "specimen", path = "Observation.specimen", description = "Specimen used for this observation", type = "reference")
3050  public static final String SP_SPECIMEN = "specimen";
3051  @SearchParamDefinition(name = "component-code", path = "Observation.component.code", description = "The component code of the observation type", type = "token")
3052  public static final String SP_COMPONENTCODE = "component-code";
3053  @SearchParamDefinition(name = "value-string", path = "Observation.valueString", description = "The value of the observation, if the value is a string, and also searches in CodeableConcept.text", type = "string")
3054  public static final String SP_VALUESTRING = "value-string";
3055  @SearchParamDefinition(name = "identifier", path = "Observation.identifier", description = "The unique id for a particular observation", type = "token")
3056  public static final String SP_IDENTIFIER = "identifier";
3057  @SearchParamDefinition(name = "component-code-value-[x]", path = "null", description = "Both component code and one of the component value parameters", type = "composite")
3058  public static final String SP_COMPONENTCODEVALUEX = "component-code-value-[x]";
3059  @SearchParamDefinition(name = "code-value-[x]", path = "null", description = "Both code and one of the value parameters", type = "composite")
3060  public static final String SP_CODEVALUEX = "code-value-[x]";
3061  @SearchParamDefinition(name = "performer", path = "Observation.performer", description = "Who performed the observation", type = "reference")
3062  public static final String SP_PERFORMER = "performer";
3063  @SearchParamDefinition(name = "value-quantity", path = "Observation.valueQuantity", 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")
3064  public static final String SP_VALUEQUANTITY = "value-quantity";
3065  @SearchParamDefinition(name = "component-value-quantity", path = "Observation.component.valueQuantity", 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")
3066  public static final String SP_COMPONENTVALUEQUANTITY = "component-value-quantity";
3067  @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")
3068  public static final String SP_DATAABSENTREASON = "data-absent-reason";
3069  @SearchParamDefinition(name = "encounter", path = "Observation.encounter", description = "Healthcare event related to the observation", type = "reference")
3070  public static final String SP_ENCOUNTER = "encounter";
3071  @SearchParamDefinition(name = "related-type", path = "Observation.related.type", description = "has-member | derived-from | sequel-to | replaces | qualified-by | interfered-by", type = "token")
3072  public static final String SP_RELATEDTYPE = "related-type";
3073  @SearchParamDefinition(name = "related-target", path = "Observation.related.target", description = "Resource that is related to this one", type = "reference")
3074  public static final String SP_RELATEDTARGET = "related-target";
3075  @SearchParamDefinition(name = "component-value-string", path = "Observation.component.valueString", description = "The value of the component observation, if the value is a string, and also searches in CodeableConcept.text", type = "string")
3076  public static final String SP_COMPONENTVALUESTRING = "component-value-string";
3077  @SearchParamDefinition(name = "component-value-concept", path = "Observation.component.valueCodeableConcept", description = "The value of the component observation, if the value is a CodeableConcept", type = "token")
3078  public static final String SP_COMPONENTVALUECONCEPT = "component-value-concept";
3079  @SearchParamDefinition(name = "category", path = "Observation.category", description = "The classification of the type of observation", type = "token")
3080  public static final String SP_CATEGORY = "category";
3081  @SearchParamDefinition(name = "device", path = "Observation.device", description = "The Device that generated the observation data.", type = "reference")
3082  public static final String SP_DEVICE = "device";
3083  @SearchParamDefinition(name = "status", path = "Observation.status", description = "The status of the observation", type = "token")
3084  public static final String SP_STATUS = "status";
3085
3086}