org.hl7.fhir.exceptions.FHIRException Java Examples

The following examples show how to use org.hl7.fhir.exceptions.FHIRException. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Bundle40_50.java    From org.hl7.fhir.core with Apache License 2.0 6 votes vote down vote up
public static org.hl7.fhir.r4.model.Bundle.BundleEntryComponent convertBundleEntryComponent(org.hl7.fhir.r5.model.Bundle.BundleEntryComponent src) throws FHIRException {
    if (src == null)
        return null;
    org.hl7.fhir.r4.model.Bundle.BundleEntryComponent tgt = new org.hl7.fhir.r4.model.Bundle.BundleEntryComponent();
    copyElement(src, tgt);
    for (org.hl7.fhir.r5.model.Bundle.BundleLinkComponent t : src.getLink()) tgt.addLink(convertBundleLinkComponent(t));
    if (src.hasFullUrl())
        tgt.setFullUrlElement(convertUri(src.getFullUrlElement()));
    if (src.hasResource())
        tgt.setResource(convertResource(src.getResource()));
    if (src.hasSearch())
        tgt.setSearch(convertBundleEntrySearchComponent(src.getSearch()));
    if (src.hasRequest())
        tgt.setRequest(convertBundleEntryRequestComponent(src.getRequest()));
    if (src.hasResponse())
        tgt.setResponse(convertBundleEntryResponseComponent(src.getResponse()));
    return tgt;
}
 
Example #2
Source File: RequestGroup40_50.java    From org.hl7.fhir.core with Apache License 2.0 6 votes vote down vote up
static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Enumerations.ActionConditionKind> convertActionConditionKind(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.RequestGroup.ActionConditionKind> src) throws FHIRException {
    if (src == null || src.isEmpty())
        return null;
    org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Enumerations.ActionConditionKind> tgt = new org.hl7.fhir.r5.model.Enumeration<>(new org.hl7.fhir.r5.model.Enumerations.ActionConditionKindEnumFactory());
    VersionConvertor_40_50.copyElement(src, tgt);
    switch(src.getValue()) {
        case APPLICABILITY:
            tgt.setValue(org.hl7.fhir.r5.model.Enumerations.ActionConditionKind.APPLICABILITY);
            break;
        case START:
            tgt.setValue(org.hl7.fhir.r5.model.Enumerations.ActionConditionKind.START);
            break;
        case STOP:
            tgt.setValue(org.hl7.fhir.r5.model.Enumerations.ActionConditionKind.STOP);
            break;
        default:
            tgt.setValue(org.hl7.fhir.r5.model.Enumerations.ActionConditionKind.NULL);
            break;
    }
    return tgt;
}
 
Example #3
Source File: StructureMapUtilities.java    From org.hl7.fhir.core with Apache License 2.0 6 votes vote down vote up
public StructureDefinition getTargetType(StructureMap map) throws FHIRException {
  boolean found = false;
  StructureDefinition res = null;
  for (StructureMapStructureComponent uses : map.getStructure()) {
    if (uses.getMode() == StructureMapModelMode.TARGET) {
      if (found)
        throw new FHIRException("Multiple targets found in map "+map.getUrl());
      found = true;
      res = worker.fetchResource(StructureDefinition.class, uses.getUrl());
      if (res == null)
        throw new FHIRException("Unable to find "+uses.getUrl()+" referenced from map "+map.getUrl());      
    }
  }
  if (res == null)
     throw new FHIRException("No targets found in map "+map.getUrl());
  return res;
}
 
Example #4
Source File: VisionPrescription40_50.java    From org.hl7.fhir.core with Apache License 2.0 6 votes vote down vote up
static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.VisionPrescription.VisionBase> convertVisionBase(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.VisionPrescription.VisionBase> src) throws FHIRException {
    if (src == null || src.isEmpty())
        return null;
    org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.VisionPrescription.VisionBase> tgt = new org.hl7.fhir.r4.model.Enumeration<>(new org.hl7.fhir.r4.model.VisionPrescription.VisionBaseEnumFactory());
    VersionConvertor_40_50.copyElement(src, tgt);
    switch(src.getValue()) {
        case UP:
            tgt.setValue(org.hl7.fhir.r4.model.VisionPrescription.VisionBase.UP);
            break;
        case DOWN:
            tgt.setValue(org.hl7.fhir.r4.model.VisionPrescription.VisionBase.DOWN);
            break;
        case IN:
            tgt.setValue(org.hl7.fhir.r4.model.VisionPrescription.VisionBase.IN);
            break;
        case OUT:
            tgt.setValue(org.hl7.fhir.r4.model.VisionPrescription.VisionBase.OUT);
            break;
        default:
            tgt.setValue(org.hl7.fhir.r4.model.VisionPrescription.VisionBase.NULL);
            break;
    }
    return tgt;
}
 
Example #5
Source File: DeviceMetric.java    From org.hl7.fhir.core with Apache License 2.0 6 votes vote down vote up
public Enumeration<DeviceMetricCategory> fromType(Base code) throws FHIRException {
  if (code == null)
    return null;
  if (code.isEmpty())
    return new Enumeration<DeviceMetricCategory>(this);
  String codeString = ((PrimitiveType) code).asStringValue();
  if (codeString == null || "".equals(codeString))
    return null;
if ("measurement".equals(codeString))
  return new Enumeration<DeviceMetricCategory>(this, DeviceMetricCategory.MEASUREMENT);
if ("setting".equals(codeString))
  return new Enumeration<DeviceMetricCategory>(this, DeviceMetricCategory.SETTING);
if ("calculation".equals(codeString))
  return new Enumeration<DeviceMetricCategory>(this, DeviceMetricCategory.CALCULATION);
if ("unspecified".equals(codeString))
  return new Enumeration<DeviceMetricCategory>(this, DeviceMetricCategory.UNSPECIFIED);
throw new FHIRException("Unknown DeviceMetricCategory code '"+codeString+"'");
}
 
Example #6
Source File: PlanDefinition30_40.java    From org.hl7.fhir.core with Apache License 2.0 6 votes vote down vote up
static public org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.PlanDefinition.ActionRequiredBehavior> convertActionRequiredBehavior(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.PlanDefinition.ActionRequiredBehavior> src) throws FHIRException {
    if (src == null || src.isEmpty())
        return null;
    org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.PlanDefinition.ActionRequiredBehavior> tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.PlanDefinition.ActionRequiredBehaviorEnumFactory());
    VersionConvertor_30_40.copyElement(src, tgt);
    switch(src.getValue()) {
        case MUST:
            tgt.setValue(org.hl7.fhir.dstu3.model.PlanDefinition.ActionRequiredBehavior.MUST);
            break;
        case COULD:
            tgt.setValue(org.hl7.fhir.dstu3.model.PlanDefinition.ActionRequiredBehavior.COULD);
            break;
        case MUSTUNLESSDOCUMENTED:
            tgt.setValue(org.hl7.fhir.dstu3.model.PlanDefinition.ActionRequiredBehavior.MUSTUNLESSDOCUMENTED);
            break;
        default:
            tgt.setValue(org.hl7.fhir.dstu3.model.PlanDefinition.ActionRequiredBehavior.NULL);
            break;
    }
    return tgt;
}
 
Example #7
Source File: SupplyRequest.java    From org.hl7.fhir.core with Apache License 2.0 6 votes vote down vote up
public Enumeration<SupplyRequestStatus> fromType(Base code) throws FHIRException {
  if (code == null)
    return null;
  if (code.isEmpty())
    return new Enumeration<SupplyRequestStatus>(this);
  String codeString = ((PrimitiveType) code).asStringValue();
  if (codeString == null || "".equals(codeString))
    return null;
if ("draft".equals(codeString))
  return new Enumeration<SupplyRequestStatus>(this, SupplyRequestStatus.DRAFT);
if ("active".equals(codeString))
  return new Enumeration<SupplyRequestStatus>(this, SupplyRequestStatus.ACTIVE);
if ("suspended".equals(codeString))
  return new Enumeration<SupplyRequestStatus>(this, SupplyRequestStatus.SUSPENDED);
if ("cancelled".equals(codeString))
  return new Enumeration<SupplyRequestStatus>(this, SupplyRequestStatus.CANCELLED);
if ("completed".equals(codeString))
  return new Enumeration<SupplyRequestStatus>(this, SupplyRequestStatus.COMPLETED);
if ("entered-in-error".equals(codeString))
  return new Enumeration<SupplyRequestStatus>(this, SupplyRequestStatus.ENTEREDINERROR);
if ("unknown".equals(codeString))
  return new Enumeration<SupplyRequestStatus>(this, SupplyRequestStatus.UNKNOWN);
throw new FHIRException("Unknown SupplyRequestStatus code '"+codeString+"'");
}
 
Example #8
Source File: AuditEvent.java    From org.hl7.fhir.core with Apache License 2.0 6 votes vote down vote up
@Override
public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
  switch (_hash) {
  case 3575610: /*type*/  return new Property("type", "Coding", "Identifier for a family of the event.  For example, a menu item, program, rule, policy, function code, application name or URL. It identifies the performed function.", 0, 1, type);
  case -1867567750: /*subtype*/  return new Property("subtype", "Coding", "Identifier for the category of event.", 0, java.lang.Integer.MAX_VALUE, subtype);
  case -1422950858: /*action*/  return new Property("action", "code", "Indicator for type of action performed during the event that generated the audit.", 0, 1, action);
  case -799233872: /*recorded*/  return new Property("recorded", "instant", "The time when the event occurred on the source.", 0, 1, recorded);
  case -1106507950: /*outcome*/  return new Property("outcome", "code", "Indicates whether the event succeeded or failed.", 0, 1, outcome);
  case 1062502659: /*outcomeDesc*/  return new Property("outcomeDesc", "string", "A free text description of the outcome of the event.", 0, 1, outcomeDesc);
  case -341917691: /*purposeOfEvent*/  return new Property("purposeOfEvent", "CodeableConcept", "The purposeOfUse (reason) that was used during the event being recorded.", 0, java.lang.Integer.MAX_VALUE, purposeOfEvent);
  case 92750597: /*agent*/  return new Property("agent", "", "An actor taking an active role in the event or activity that is logged.", 0, java.lang.Integer.MAX_VALUE, agent);
  case -896505829: /*source*/  return new Property("source", "", "The system that is reporting the event.", 0, 1, source);
  case -1298275357: /*entity*/  return new Property("entity", "", "Specific instances of data or objects that have been accessed.", 0, java.lang.Integer.MAX_VALUE, entity);
  default: return super.getNamedProperty(_hash, _name, _checkValid);
  }

}
 
Example #9
Source File: Element.java    From org.hl7.fhir.core with Apache License 2.0 6 votes vote down vote up
public void setChildValue(String name, String value) {
  if (children == null)
    children = new ArrayList<Element>();
  for (Element child : children) {
    if (name.equals(child.getName())) {
      if (!child.isPrimitive())
        throw new Error("Cannot set a value of a non-primitive type ("+name+" on "+this.getName()+")");
      child.setValue(value);
    }
  }
  try {
    setProperty(name.hashCode(), name, new StringType(value));
  } catch (FHIRException e) {
    throw new Error(e);
  }
}
 
Example #10
Source File: Communication40_50.java    From org.hl7.fhir.core with Apache License 2.0 6 votes vote down vote up
public static org.hl7.fhir.r5.model.Communication.CommunicationPayloadComponent convertCommunicationPayloadComponent(org.hl7.fhir.r4.model.Communication.CommunicationPayloadComponent src) throws FHIRException {
    if (src == null)
        return null;
    org.hl7.fhir.r5.model.Communication.CommunicationPayloadComponent tgt = new org.hl7.fhir.r5.model.Communication.CommunicationPayloadComponent();
    copyElement(src, tgt);
    if (src.hasContent()) {
        if (src.getContent() instanceof StringType) {
            CodeableConcept tgtc = new CodeableConcept();
            copyElement(src.getContent(), tgtc);
            tgtc.setText(src.getContentStringType().getValue());
            tgt.setContent(tgtc);
        } else {
            if (src.hasContent())
                tgt.setContent(convertType(src.getContent()));
        }
    }
    return tgt;
}
 
Example #11
Source File: Appointment.java    From org.hl7.fhir.core with Apache License 2.0 6 votes vote down vote up
public Enumeration<ParticipationStatus> fromType(Base code) throws FHIRException {
  if (code == null)
    return null;
  if (code.isEmpty())
    return new Enumeration<ParticipationStatus>(this);
  String codeString = ((PrimitiveType) code).asStringValue();
  if (codeString == null || "".equals(codeString))
    return null;
if ("accepted".equals(codeString))
  return new Enumeration<ParticipationStatus>(this, ParticipationStatus.ACCEPTED);
if ("declined".equals(codeString))
  return new Enumeration<ParticipationStatus>(this, ParticipationStatus.DECLINED);
if ("tentative".equals(codeString))
  return new Enumeration<ParticipationStatus>(this, ParticipationStatus.TENTATIVE);
if ("needs-action".equals(codeString))
  return new Enumeration<ParticipationStatus>(this, ParticipationStatus.NEEDSACTION);
throw new FHIRException("Unknown ParticipationStatus code '"+codeString+"'");
}
 
Example #12
Source File: Signature.java    From org.hl7.fhir.core with Apache License 2.0 6 votes vote down vote up
@Override
public Base setProperty(int hash, String name, Base value) throws FHIRException {
  switch (hash) {
  case 3575610: // type
    this.getType().add(castToCoding(value)); // Coding
    return value;
  case 3648314: // when
    this.when = castToInstant(value); // InstantType
    return value;
  case 117694: // who
    this.who = castToType(value); // Type
    return value;
  case -14402964: // onBehalfOf
    this.onBehalfOf = castToType(value); // Type
    return value;
  case -389131437: // contentType
    this.contentType = castToCode(value); // CodeType
    return value;
  case 3026845: // blob
    this.blob = castToBase64Binary(value); // Base64BinaryType
    return value;
  default: return super.setProperty(hash, name, value);
  }

}
 
Example #13
Source File: MessageHeader.java    From org.hl7.fhir.core with Apache License 2.0 6 votes vote down vote up
@Override
public Base addChild(String name) throws FHIRException {
  if (name.equals("name")) {
    throw new FHIRException("Cannot call addChild on a primitive type MessageHeader.name");
  }
  else if (name.equals("software")) {
    throw new FHIRException("Cannot call addChild on a primitive type MessageHeader.software");
  }
  else if (name.equals("version")) {
    throw new FHIRException("Cannot call addChild on a primitive type MessageHeader.version");
  }
  else if (name.equals("contact")) {
    this.contact = new ContactPoint();
    return this.contact;
  }
  else if (name.equals("endpoint")) {
    throw new FHIRException("Cannot call addChild on a primitive type MessageHeader.endpoint");
  }
  else
    return super.addChild(name);
}
 
Example #14
Source File: CSVReader.java    From org.hl7.fhir.core with Apache License 2.0 6 votes vote down vote up
public String cell(String name) {
  int index = -1;
  for (int i = 0; i < cols.length; i++) {
    if (name.equals(cols[i].trim()))
      index = i;
  }
  if (index == -1)
    throw new FHIRException("no cell "+name);
  String s = cells.length >= index ? cells[index] : null;
  if (Utilities.noString(s))
    return null;
  if (s.startsWith("\"") && s.endsWith("\"")) {
    return s.substring(1, s.length()-2);     
  } else {
    return s;
  }
}
 
Example #15
Source File: Dosage.java    From org.hl7.fhir.core with Apache License 2.0 6 votes vote down vote up
@Override
public Base makeProperty(int hash, String name) throws FHIRException {
  switch (hash) {
  case 1349547969:  return getSequenceElement();
  case 3556653:  return getTextElement();
  case 1623641575:  return addAdditionalInstruction(); 
  case 737543241:  return getPatientInstructionElement();
  case -873664438:  return getTiming();
  case -544329575:  return getAsNeeded();
  case -1432923513:  return getAsNeeded();
  case 3530567:  return getSite();
  case 108704329:  return getRoute();
  case -1077554975:  return getMethod();
  case -611024774:  return addDoseAndRate(); 
  case 1506263709:  return getMaxDosePerPeriod();
  case 2004889914:  return getMaxDosePerAdministration();
  case 642099621:  return getMaxDosePerLifetime();
  default: return super.makeProperty(hash, name);
  }

}
 
Example #16
Source File: SubstancePolymer.java    From org.hl7.fhir.core with Apache License 2.0 6 votes vote down vote up
@Override
public Base setProperty(int hash, String name, Base value) throws FHIRException {
  switch (hash) {
  case 299066663: // material
    this.material = castToCodeableConcept(value); // CodeableConcept
    return value;
  case 3575610: // type
    this.type = castToCodeableConcept(value); // CodeableConcept
    return value;
  case -141812990: // isDefining
    this.isDefining = castToBoolean(value); // BooleanType
    return value;
  case -1413853096: // amount
    this.amount = castToSubstanceAmount(value); // SubstanceAmount
    return value;
  default: return super.setProperty(hash, name, value);
  }

}
 
Example #17
Source File: NUCCConvertor.java    From org.hl7.fhir.core with Apache License 2.0 6 votes vote down vote up
public void execute() throws IOException, FHIRException {
  CSVReader csv = new CSVReader(new FileInputStream("c:\\temp\\nucc.csv"));
  CodeSystem cs = new CodeSystem();
  cs.setId("nucc-provider-taxonomy");
  cs.setUrl("http://nucc.org/provider-taxonomy");
  cs.setName("NUCC Provider Taxonomy");
  cs.setDateElement(new DateTimeType());
  cs.setDescription("The Health Care Provider Taxonomy code is a unique alphanumeric code, ten characters in length. The code set is structured into three distinct 'Levels' including Provider Type, Classification, and Area of Specialization");
  cs.setCopyright("See NUCC copyright statement");
  cs.setStatus(PublicationStatus.ACTIVE);
  cs.setContent(CodeSystemContentMode.COMPLETE);
  cs.setExperimental(false);
  cs.setValueSet("http://hl7.org/fhir/ValueSet/nucc-provider-taxonomy"); 
  cs.setHierarchyMeaning(CodeSystemHierarchyMeaning.CLASSIFIEDWITH);
  csv.parseLine();
  while (csv.ready())
  {
    String[] values = csv.parseLine();
    processLine(cs, values);
  }     
  csv.close();
  new XmlParser().setOutputStyle(OutputStyle.PRETTY).compose(new FileOutputStream("c:\\temp\\nucc.xml"), cs);
}
 
Example #18
Source File: StructureMap14_50.java    From org.hl7.fhir.core with Apache License 2.0 6 votes vote down vote up
public static org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleTargetComponent convertStructureMapGroupRuleTargetComponent(org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleTargetComponent src) throws FHIRException {
    if (src == null || src.isEmpty())
        return null;
    org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleTargetComponent tgt = new org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleTargetComponent();
    VersionConvertor_14_50.copyElement(src, tgt);
    if (src.hasContext())
        tgt.setContextElement(VersionConvertor_14_50.convertId(src.getContextElement()));
    if (src.hasContextType())
        tgt.setContextTypeElement(convertStructureMapContextType(src.getContextTypeElement()));
    if (src.hasElement())
        tgt.setElementElement(VersionConvertor_14_50.convertString(src.getElementElement()));
    if (src.hasVariable())
        tgt.setVariableElement(VersionConvertor_14_50.convertId(src.getVariableElement()));
    tgt.setListMode(src.getListMode().stream()
            .map(StructureMap14_50::convertStructureMapTargetListMode)
            .collect(Collectors.toList()));
    if (src.hasListRuleId())
        tgt.setListRuleIdElement(VersionConvertor_14_50.convertId(src.getListRuleIdElement()));
    if (src.hasTransform())
        tgt.setTransformElement(convertStructureMapTransform(src.getTransformElement()));
    for (org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleTargetParameterComponent t : src.getParameter()) tgt.addParameter(convertStructureMapGroupRuleTargetParameterComponent(t));
    return tgt;
}
 
Example #19
Source File: Bundle.java    From org.hl7.fhir.core with Apache License 2.0 6 votes vote down vote up
public static BundleType fromCode(String codeString) throws FHIRException {
    if (codeString == null || "".equals(codeString))
        return null;
if ("document".equals(codeString))
  return DOCUMENT;
if ("message".equals(codeString))
  return MESSAGE;
if ("transaction".equals(codeString))
  return TRANSACTION;
if ("transaction-response".equals(codeString))
  return TRANSACTIONRESPONSE;
if ("batch".equals(codeString))
  return BATCH;
if ("batch-response".equals(codeString))
  return BATCHRESPONSE;
if ("history".equals(codeString))
  return HISTORY;
if ("searchset".equals(codeString))
  return SEARCHSET;
if ("collection".equals(codeString))
  return COLLECTION;
throw new FHIRException("Unknown BundleType code '"+codeString+"'");
}
 
Example #20
Source File: ManufacturedItemDefinition.java    From org.hl7.fhir.core with Apache License 2.0 5 votes vote down vote up
@Override
public String[] getTypesForProperty(int hash, String name) throws FHIRException {
  switch (hash) {
  case -1618432855: /*identifier*/ return new String[] {"Identifier"};
  case -1451400348: /*manufacturedDoseForm*/ return new String[] {"CodeableConcept"};
  case -1427765963: /*unitOfPresentation*/ return new String[] {"CodeableConcept"};
  case -1969347631: /*manufacturer*/ return new String[] {"Reference"};
  case -206409263: /*ingredient*/ return new String[] {"Reference"};
  case -993141291: /*property*/ return new String[] {};
  default: return super.getTypesForProperty(hash, name);
  }

}
 
Example #21
Source File: NarrativeGenerator.java    From org.hl7.fhir.core with Apache License 2.0 5 votes vote down vote up
private void generateResourceSummary(XhtmlNode x, ResourceWrapper res, boolean textAlready, boolean showCodeDetails) throws FHIRException, UnsupportedEncodingException, IOException {
  if (!textAlready) {
    XhtmlNode div = res.getNarrative();
    if (div != null) {
      if (div.allChildrenAreText())
        x.getChildNodes().addAll(div.getChildNodes());
      if (div.getChildNodes().size() == 1 && div.getChildNodes().get(0).allChildrenAreText())
        x.getChildNodes().addAll(div.getChildNodes().get(0).getChildNodes());
    }
    x.addText("Generated Summary: ");
  }
  String path = res.getName();
  StructureDefinition profile = context.fetchResource(StructureDefinition.class, path);
  if (profile == null)
    x.addText("unknown resource " +path);
  else {
    boolean firstElement = true;
    boolean last = false;
    for (PropertyWrapper p : res.children()) {
      ElementDefinition child = getElementDefinition(profile.getSnapshot().getElement(), path+"."+p.getName(), p);
      if (p.getValues().size() > 0 && p.getValues().get(0) != null && child != null && isPrimitive(child) && includeInSummary(child)) {
        if (firstElement)
          firstElement = false;
        else if (last)
          x.addText("; ");
        boolean first = true;
        last = false;
        for (BaseWrapper v : p.getValues()) {
          if (first)
            first = false;
          else if (last)
            x.addText(", ");
          last = displayLeaf(res, v, child, x, p.getName(), showCodeDetails) || last;
        }
      }
    }
  }
}
 
Example #22
Source File: GraphDefinition30_50.java    From org.hl7.fhir.core with Apache License 2.0 5 votes vote down vote up
static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Enumerations.CompartmentType> convertCompartmentCode(org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.GraphDefinition.CompartmentCode> src) throws FHIRException {
    if (src == null || src.isEmpty())
        return null;
    org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Enumerations.CompartmentType> tgt = new org.hl7.fhir.r5.model.Enumeration<>(new org.hl7.fhir.r5.model.Enumerations.CompartmentTypeEnumFactory());
    VersionConvertor_30_50.copyElement(src, tgt);
    switch(src.getValue()) {
        case PATIENT:
            tgt.setValue(org.hl7.fhir.r5.model.Enumerations.CompartmentType.PATIENT);
            break;
        case ENCOUNTER:
            tgt.setValue(org.hl7.fhir.r5.model.Enumerations.CompartmentType.ENCOUNTER);
            break;
        case RELATEDPERSON:
            tgt.setValue(org.hl7.fhir.r5.model.Enumerations.CompartmentType.RELATEDPERSON);
            break;
        case PRACTITIONER:
            tgt.setValue(org.hl7.fhir.r5.model.Enumerations.CompartmentType.PRACTITIONER);
            break;
        case DEVICE:
            tgt.setValue(org.hl7.fhir.r5.model.Enumerations.CompartmentType.DEVICE);
            break;
        default:
            tgt.setValue(org.hl7.fhir.r5.model.Enumerations.CompartmentType.NULL);
            break;
    }
    return tgt;
}
 
Example #23
Source File: MessageHeader.java    From org.hl7.fhir.core with Apache License 2.0 5 votes vote down vote up
@Override
public Base makeProperty(int hash, String name) throws FHIRException {
  switch (hash) {
  case 3373707:  return getNameElement();
  case 1319330215:  return getSoftwareElement();
  case 351608024:  return getVersionElement();
  case 951526432:  return getContact(); 
  case 1741102485:  return getEndpointElement();
  default: return super.makeProperty(hash, name);
  }

}
 
Example #24
Source File: SubstanceAmount.java    From org.hl7.fhir.core with Apache License 2.0 5 votes vote down vote up
@Override
public Base makeProperty(int hash, String name) throws FHIRException {
  switch (hash) {
  case 646780200:  return getAmount();
  case -1413853096:  return getAmount();
  case -1424857166:  return getAmountType();
  case -1424876123:  return getAmountTextElement();
  case -1912545102:  return getReferenceRange();
  default: return super.makeProperty(hash, name);
  }

}
 
Example #25
Source File: Bundle.java    From org.hl7.fhir.core with Apache License 2.0 5 votes vote down vote up
@Override
public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
  switch (_hash) {
  case 3321850: /*link*/  return new Property("link", "@Bundle.link", "A series of links that provide context to this entry.", 0, java.lang.Integer.MAX_VALUE, link);
  case -511251360: /*fullUrl*/  return new Property("fullUrl", "uri", "The Absolute URL for the resource.  The fullUrl SHALL NOT disagree with the id in the resource - i.e. if the fullUrl is not a urn:uuid, the URL shall be version-independent URL consistent with the Resource.id. The fullUrl is a version independent reference to the resource. The fullUrl element SHALL have a value except that: \n* fullUrl can be empty on a POST (although it does not need to when specifying a temporary id for reference in the bundle)\n* Results from operations might involve resources that are not identified.", 0, 1, fullUrl);
  case -341064690: /*resource*/  return new Property("resource", "Resource", "The Resource for the entry. The purpose/meaning of the resource is determined by the Bundle.type.", 0, 1, resource);
  case -906336856: /*search*/  return new Property("search", "", "Information about the search process that lead to the creation of this entry.", 0, 1, search);
  case 1095692943: /*request*/  return new Property("request", "", "Additional information about how this entry should be processed as part of a transaction or batch.  For history, it shows how the entry was processed to create the version contained in the entry.", 0, 1, request);
  case -340323263: /*response*/  return new Property("response", "", "Indicates the results of processing the corresponding 'request' entry in the batch or transaction being responded to or what the results of an operation where when returning history.", 0, 1, response);
  default: return super.getNamedProperty(_hash, _name, _checkValid);
  }

}
 
Example #26
Source File: VerificationResult.java    From org.hl7.fhir.core with Apache License 2.0 5 votes vote down vote up
@Override
public Base setProperty(String name, Base value) throws FHIRException {
  if (name.equals("target")) {
    this.getTarget().add(TypeConvertor.castToReference(value));
  } else if (name.equals("targetLocation")) {
    this.getTargetLocation().add(TypeConvertor.castToString(value));
  } else if (name.equals("need")) {
    this.need = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
  } else if (name.equals("status")) {
    value = new StatusEnumFactory().fromType(TypeConvertor.castToCode(value));
    this.status = (Enumeration) value; // Enumeration<Status>
  } else if (name.equals("statusDate")) {
    this.statusDate = TypeConvertor.castToDateTime(value); // DateTimeType
  } else if (name.equals("validationType")) {
    this.validationType = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
  } else if (name.equals("validationProcess")) {
    this.getValidationProcess().add(TypeConvertor.castToCodeableConcept(value));
  } else if (name.equals("frequency")) {
    this.frequency = TypeConvertor.castToTiming(value); // Timing
  } else if (name.equals("lastPerformed")) {
    this.lastPerformed = TypeConvertor.castToDateTime(value); // DateTimeType
  } else if (name.equals("nextScheduled")) {
    this.nextScheduled = TypeConvertor.castToDate(value); // DateType
  } else if (name.equals("failureAction")) {
    this.failureAction = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
  } else if (name.equals("primarySource")) {
    this.getPrimarySource().add((VerificationResultPrimarySourceComponent) value);
  } else if (name.equals("attestation")) {
    this.attestation = (VerificationResultAttestationComponent) value; // VerificationResultAttestationComponent
  } else if (name.equals("validator")) {
    this.getValidator().add((VerificationResultValidatorComponent) value);
  } else
    return super.setProperty(name, value);
  return value;
}
 
Example #27
Source File: SnapShotGenerationTests.java    From org.hl7.fhir.core with Apache License 2.0 5 votes vote down vote up
private StructureDefinition getSD(String url, SnapShotGenerationTestsContext context) throws DefinitionException, FHIRException {
  StructureDefinition sd = TestingUtilities.context.fetchResource(StructureDefinition.class, url);
  if (sd == null)
    sd = context.snapshots.get(url);
  if (sd == null)
    sd = findContainedProfile(url, context);
  return sd;
}
 
Example #28
Source File: BiologicallyDerivedProduct.java    From org.hl7.fhir.core with Apache License 2.0 5 votes vote down vote up
@Override
public String[] getTypesForProperty(int hash, String name) throws FHIRException {
  switch (hash) {
  case -1724546052: /*description*/ return new String[] {"string"};
  case -1095204141: /*procedure*/ return new String[] {"CodeableConcept"};
  case -1226589236: /*additive*/ return new String[] {"Reference"};
  case 3560141: /*time*/ return new String[] {"dateTime", "Period"};
  default: return super.getTypesForProperty(hash, name);
  }

}
 
Example #29
Source File: ProcedureRequest.java    From org.hl7.fhir.core with Apache License 2.0 5 votes vote down vote up
@Override
public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
  switch (_hash) {
  case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "Identifiers assigned to this order instance by the orderer and/or the receiver and/or order fulfiller.", 0, java.lang.Integer.MAX_VALUE, identifier);
  case -1014418093: /*definition*/  return new Property("definition", "Reference(ActivityDefinition|PlanDefinition)", "Protocol or definition followed by this request.", 0, java.lang.Integer.MAX_VALUE, definition);
  case -332612366: /*basedOn*/  return new Property("basedOn", "Reference(Any)", "Plan/proposal/order fulfilled by this request.", 0, java.lang.Integer.MAX_VALUE, basedOn);
  case -430332865: /*replaces*/  return new Property("replaces", "Reference(Any)", "The request takes the place of the referenced completed or terminated request(s).", 0, java.lang.Integer.MAX_VALUE, replaces);
  case 395923612: /*requisition*/  return new Property("requisition", "Identifier", "A shared identifier common to all procedure or diagnostic requests that were authorized more or less simultaneously by a single author, representing the composite or group identifier.", 0, 1, requisition);
  case -892481550: /*status*/  return new Property("status", "code", "The status of the order.", 0, 1, status);
  case -1183762788: /*intent*/  return new Property("intent", "code", "Whether the request is a proposal, plan, an original order or a reflex order.", 0, 1, intent);
  case -1165461084: /*priority*/  return new Property("priority", "code", "Indicates how quickly the ProcedureRequest should be addressed with respect to other requests.", 0, 1, priority);
  case -1788508167: /*doNotPerform*/  return new Property("doNotPerform", "boolean", "Set this to true if the record is saying that the procedure should NOT be performed.", 0, 1, doNotPerform);
  case 50511102: /*category*/  return new Property("category", "CodeableConcept", "A code that classifies the procedure for searching, sorting and display purposes (e.g. \"Surgical Procedure\").", 0, java.lang.Integer.MAX_VALUE, category);
  case 3059181: /*code*/  return new Property("code", "CodeableConcept", "A code that identifies a particular procedure, diagnostic investigation, or panel of investigations, that have been requested.", 0, 1, code);
  case -1867885268: /*subject*/  return new Property("subject", "Reference(Patient|Group|Location|Device)", "On whom or what the procedure or diagnostic is to be performed. This is usually a human patient, but can also be requested on animals, groups of humans or animals, devices such as dialysis machines, or even locations (typically for environmental scans).", 0, 1, subject);
  case 951530927: /*context*/  return new Property("context", "Reference(Encounter|EpisodeOfCare)", "An encounter or episode of care that provides additional information about the healthcare context in which this request is made.", 0, 1, context);
  case -2022646513: /*occurrence[x]*/  return new Property("occurrence[x]", "dateTime|Period|Timing", "The date/time at which the diagnostic testing should occur.", 0, 1, occurrence);
  case 1687874001: /*occurrence*/  return new Property("occurrence[x]", "dateTime|Period|Timing", "The date/time at which the diagnostic testing should occur.", 0, 1, occurrence);
  case -298443636: /*occurrenceDateTime*/  return new Property("occurrence[x]", "dateTime|Period|Timing", "The date/time at which the diagnostic testing should occur.", 0, 1, occurrence);
  case 1397156594: /*occurrencePeriod*/  return new Property("occurrence[x]", "dateTime|Period|Timing", "The date/time at which the diagnostic testing should occur.", 0, 1, occurrence);
  case 1515218299: /*occurrenceTiming*/  return new Property("occurrence[x]", "dateTime|Period|Timing", "The date/time at which the diagnostic testing should occur.", 0, 1, occurrence);
  case -544329575: /*asNeeded[x]*/  return new Property("asNeeded[x]", "boolean|CodeableConcept", "If a CodeableConcept is present, it indicates the pre-condition for performing the procedure.  For example \"pain\", \"on flare-up\", etc.", 0, 1, asNeeded);
  case -1432923513: /*asNeeded*/  return new Property("asNeeded[x]", "boolean|CodeableConcept", "If a CodeableConcept is present, it indicates the pre-condition for performing the procedure.  For example \"pain\", \"on flare-up\", etc.", 0, 1, asNeeded);
  case -591717471: /*asNeededBoolean*/  return new Property("asNeeded[x]", "boolean|CodeableConcept", "If a CodeableConcept is present, it indicates the pre-condition for performing the procedure.  For example \"pain\", \"on flare-up\", etc.", 0, 1, asNeeded);
  case 1556420122: /*asNeededCodeableConcept*/  return new Property("asNeeded[x]", "boolean|CodeableConcept", "If a CodeableConcept is present, it indicates the pre-condition for performing the procedure.  For example \"pain\", \"on flare-up\", etc.", 0, 1, asNeeded);
  case -1500852503: /*authoredOn*/  return new Property("authoredOn", "dateTime", "When the request transitioned to being actionable.", 0, 1, authoredOn);
  case 693933948: /*requester*/  return new Property("requester", "", "The individual who initiated the request and has responsibility for its activation.", 0, 1, requester);
  case -901444568: /*performerType*/  return new Property("performerType", "CodeableConcept", "Desired type of performer for doing the diagnostic testing.", 0, 1, performerType);
  case 481140686: /*performer*/  return new Property("performer", "Reference(Practitioner|Organization|Patient|Device|RelatedPerson|HealthcareService)", "The desired perfomer for doing the diagnostic testing.  For example, the surgeon, dermatopathologist, endoscopist, etc.", 0, 1, performer);
  case 722137681: /*reasonCode*/  return new Property("reasonCode", "CodeableConcept", "An explanation or justification for why this diagnostic investigation is being requested in coded or textual form.   This is often for billing purposes.  May relate to the resources referred to in supportingInformation.", 0, java.lang.Integer.MAX_VALUE, reasonCode);
  case -1146218137: /*reasonReference*/  return new Property("reasonReference", "Reference(Condition|Observation)", "Indicates another resource that provides a justification for why this diagnostic investigation is being requested.   May relate to the resources referred to in supportingInformation.", 0, java.lang.Integer.MAX_VALUE, reasonReference);
  case 1922406657: /*supportingInfo*/  return new Property("supportingInfo", "Reference(Any)", "Additional clinical information about the patient or specimen that may influence the procedure or diagnostics or their interpretations.     This information includes diagnosis, clinical findings and other observations.  In laboratory ordering these are typically referred to as \"ask at order entry questions (AOEs)\".  This includes observations explicitly requested by the producer (filler) to provide context or supporting information needed to complete the order. For example,  reporting the amount of inspired oxygen for blood gas measurements.", 0, java.lang.Integer.MAX_VALUE, supportingInfo);
  case -2132868344: /*specimen*/  return new Property("specimen", "Reference(Specimen)", "One or more specimens that the laboratory procedure will use.", 0, java.lang.Integer.MAX_VALUE, specimen);
  case 1702620169: /*bodySite*/  return new Property("bodySite", "CodeableConcept", "Anatomic location where the procedure should be performed. This is the target site.", 0, java.lang.Integer.MAX_VALUE, bodySite);
  case 3387378: /*note*/  return new Property("note", "Annotation", "Any other notes and comments made about the service request. For example, letting provider know that \"patient hates needles\" or other provider instructions.", 0, java.lang.Integer.MAX_VALUE, note);
  case 1538891575: /*relevantHistory*/  return new Property("relevantHistory", "Reference(Provenance)", "Key events in the history of the request.", 0, java.lang.Integer.MAX_VALUE, relevantHistory);
  default: return super.getNamedProperty(_hash, _name, _checkValid);
  }

}
 
Example #30
Source File: ListResource.java    From org.hl7.fhir.core with Apache License 2.0 5 votes vote down vote up
@Override
public String[] getTypesForProperty(int hash, String name) throws FHIRException {
  switch (hash) {
  case 3145580: /*flag*/ return new String[] {"CodeableConcept"};
  case 1550463001: /*deleted*/ return new String[] {"boolean"};
  case 3076014: /*date*/ return new String[] {"dateTime"};
  case 3242771: /*item*/ return new String[] {"Reference"};
  default: return super.getTypesForProperty(hash, name);
  }

}