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