Sync to latest R4 code

This commit is contained in:
jamesagnew 2018-03-04 11:02:47 -05:00
parent b2ceb87a70
commit 07290ae8a0
1761 changed files with 1314936 additions and 1373241 deletions

View File

@ -0,0 +1,7 @@
package org.hl7.fhir.convertors;
public class VersionConvertorConstants {
public final static String MODIFIER_REASON_EXTENSION = "http://hl7.org/fhir/tooling/StructureDefinition/r4ModifierReason";
public final static String MODIFIER_REASON_LEGACY = "No Modifier Reason provideed in previous versions of FHIR";
}

View File

@ -26,7 +26,7 @@ import java.util.List;
import org.apache.commons.codec.binary.Base64;
import org.hl7.fhir.instance.model.CodeableConcept;
import org.hl7.fhir.instance.model.Reference;
import org.hl7.fhir.dstu2.utils.ToolingExtensions;
import org.hl7.fhir.instance.utils.ToolingExtensions;
import org.hl7.fhir.dstu3.conformance.ProfileUtilities;
import org.hl7.fhir.dstu3.model.Annotation;
import org.hl7.fhir.dstu3.model.CapabilityStatement.SystemRestfulInteraction;
@ -10974,7 +10974,7 @@ public class VersionConvertor_10_30 {
tgt.setBase(t.asStringValue());
tgt.setType(convertSearchParamType(src.getType()));
tgt.setDescription(src.getDescription());
org.hl7.fhir.dstu2.utils.ToolingExtensions.setStringExtension(tgt, ToolingExtensions.EXT_EXPRESSION, src.getExpression());
org.hl7.fhir.instance.utils.ToolingExtensions.setStringExtension(tgt, ToolingExtensions.EXT_EXPRESSION, src.getExpression());
tgt.setXpath(src.getXpath());
tgt.setXpathUsage(convertXPathUsageType(src.getXpathUsage()));
for (org.hl7.fhir.dstu3.model.CodeType t : src.getTarget())

View File

@ -1,487 +0,0 @@
package org.hl7.fhir.dstu2.utils;
/*
* #%L
* HAPI FHIR - Converter
* %%
* Copyright (C) 2014 - 2018 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
import java.net.URISyntaxException;
/*
Copyright (c) 2011+, HL7, Inc
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of HL7 nor the names of its contributors may be used to
endorse or promote products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.hl7.fhir.instance.model.BooleanType;
import org.hl7.fhir.instance.model.CodeType;
import org.hl7.fhir.instance.model.CodeableConcept;
import org.hl7.fhir.instance.model.Coding;
import org.hl7.fhir.instance.model.DataElement;
import org.hl7.fhir.instance.model.DomainResource;
import org.hl7.fhir.instance.model.Element;
import org.hl7.fhir.instance.model.ElementDefinition;
import org.hl7.fhir.instance.model.Extension;
import org.hl7.fhir.instance.model.ExtensionHelper;
import org.hl7.fhir.instance.model.Factory;
import org.hl7.fhir.instance.model.Identifier;
import org.hl7.fhir.instance.model.IntegerType;
import org.hl7.fhir.instance.model.MarkdownType;
import org.hl7.fhir.instance.model.PrimitiveType;
import org.hl7.fhir.instance.model.Questionnaire.GroupComponent;
import org.hl7.fhir.instance.model.Questionnaire.QuestionComponent;
import org.hl7.fhir.instance.model.Reference;
import org.hl7.fhir.instance.model.StringType;
import org.hl7.fhir.instance.model.Type;
import org.hl7.fhir.instance.model.UriType;
import org.hl7.fhir.instance.model.ValueSet;
import org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionComponent;
import org.hl7.fhir.instance.model.ValueSet.ValueSetCodeSystemComponent;
import org.hl7.fhir.utilities.validation.ValidationMessage.Source;
import org.hl7.fhir.exceptions.FHIRFormatError;
import org.hl7.fhir.utilities.Utilities;
public class ToolingExtensions {
// validated
public static final String EXT_SUBSUMES = "http://hl7.org/fhir/StructureDefinition/valueset-subsumes";
private static final String EXT_OID = "http://hl7.org/fhir/StructureDefinition/valueset-oid";
public static final String EXT_DEPRECATED = "http://hl7.org/fhir/StructureDefinition/valueset-deprecated";
public static final String EXT_DEFINITION = "http://hl7.org/fhir/StructureDefinition/valueset-definition";
public static final String EXT_COMMENT = "http://hl7.org/fhir/StructureDefinition/valueset-comments";
private static final String EXT_IDENTIFIER = "http://hl7.org/fhir/StructureDefinition/identifier";
private static final String EXT_TRANSLATION = "http://hl7.org/fhir/StructureDefinition/translation";
public static final String EXT_ISSUE_SOURCE = "http://hl7.org/fhir/StructureDefinition/operationoutcome-issue-source";
public static final String EXT_DISPLAY_HINT = "http://hl7.org/fhir/StructureDefinition/structuredefinition-display-hint";
public static final String EXT_REPLACED_BY = "http://hl7.org/fhir/StructureDefinition/valueset-replacedby";
public static final String EXT_JSON_TYPE = "http://hl7.org/fhir/StructureDefinition/structuredefinition-json-type";
public static final String EXT_XML_TYPE = "http://hl7.org/fhir/StructureDefinition/structuredefinition-xml-type";
public static final String EXT_REGEX = "http://hl7.org/fhir/StructureDefinition/structuredefinition-regex";
public static final String EXT_EXPRESSION = "http://hl7.org/fhir/StructureDefinition/structuredefinition-expression";
public static final String EXT_SEARCH_EXPRESSION = "http://hl7.org/fhir/StructureDefinition/searchparameter-expression";
// unregistered?
public static final String EXT_FLYOVER = "http://hl7.org/fhir/Profile/questionnaire-extensions#flyover";
private static final String EXT_QTYPE = "http://www.healthintersections.com.au/fhir/Profile/metadata#type";
private static final String EXT_QREF = "http://www.healthintersections.com.au/fhir/Profile/metadata#reference";
private static final String EXTENSION_FILTER_ONLY = "http://www.healthintersections.com.au/fhir/Profile/metadata#expandNeedsFilter";
private static final String EXT_TYPE = "http://www.healthintersections.com.au/fhir/Profile/metadata#type";
private static final String EXT_REFERENCE = "http://www.healthintersections.com.au/fhir/Profile/metadata#reference";
private static final String EXT_ALLOWABLE_UNITS = "http://hl7.org/fhir/StructureDefinition/elementdefinition-allowedUnits";
public static final String EXT_CIMI_REFERENCE = "http://hl7.org/fhir/StructureDefinition/cimi-reference";
public static final String EXT_UNCLOSED = "http://hl7.org/fhir/StructureDefinition/valueset-unclosed";
public static final String EXT_FMM_LEVEL = "http://hl7.org/fhir/StructureDefinition/structuredefinition-fmm";
// specific extension helpers
public static Extension makeIssueSource(Source source) {
Extension ex = new Extension();
// todo: write this up and get it published with the pack (and handle the redirect?)
ex.setUrl(ToolingExtensions.EXT_ISSUE_SOURCE);
CodeType c = new CodeType();
c.setValue(source.toString());
ex.setValue(c);
return ex;
}
public static boolean hasExtension(DomainResource de, String url) {
return getExtension(de, url) != null;
}
public static boolean hasExtension(Element e, String url) {
return getExtension(e, url) != null;
}
public static void addStringExtension(DomainResource dr, String url, String content) {
if (!Utilities.noString(content)) {
Extension ex = getExtension(dr, url);
if (ex != null)
ex.setValue(new StringType(content));
else
dr.getExtension().add(Factory.newExtension(url, new StringType(content), true));
}
}
public static void addStringExtension(Element e, String url, String content) {
if (!Utilities.noString(content)) {
Extension ex = getExtension(e, url);
if (ex != null)
ex.setValue(new StringType(content));
else
e.getExtension().add(Factory.newExtension(url, new StringType(content), true));
}
}
public static void addIntegerExtension(DomainResource dr, String url, int value) {
Extension ex = getExtension(dr, url);
if (ex != null)
ex.setValue(new IntegerType(value));
else
dr.getExtension().add(Factory.newExtension(url, new IntegerType(value), true));
}
public static void addComment(Element nc, String comment) {
if (!Utilities.noString(comment))
nc.getExtension().add(Factory.newExtension(EXT_COMMENT, Factory.newString_(comment), true));
}
public static void markDeprecated(Element nc) {
setDeprecated(nc);
}
public static void addSubsumes(ConceptDefinitionComponent nc, String code) {
nc.getModifierExtension().add(Factory.newExtension(EXT_SUBSUMES, Factory.newCode(code), true));
}
public static void addDefinition(Element nc, String definition) {
if (!Utilities.noString(definition))
nc.getExtension().add(Factory.newExtension(EXT_DEFINITION, Factory.newString_(definition), true));
}
public static void addDisplayHint(Element def, String hint) {
if (!Utilities.noString(hint))
def.getExtension().add(Factory.newExtension(EXT_DISPLAY_HINT, Factory.newString_(hint), true));
}
public static String getDisplayHint(Element def) {
return readStringExtension(def, EXT_DISPLAY_HINT);
}
public static String readStringExtension(Element c, String uri) {
Extension ex = ExtensionHelper.getExtension(c, uri);
if (ex == null)
return null;
if (ex.getValue() instanceof UriType)
return ((UriType) ex.getValue()).getValue();
if (!(ex.getValue() instanceof StringType))
return null;
return ((StringType) ex.getValue()).getValue();
}
public static String readStringExtension(DomainResource c, String uri) {
Extension ex = getExtension(c, uri);
if (ex == null)
return null;
if ((ex.getValue() instanceof StringType))
return ((StringType) ex.getValue()).getValue();
if ((ex.getValue() instanceof UriType))
return ((UriType) ex.getValue()).getValue();
if ((ex.getValue() instanceof MarkdownType))
return ((MarkdownType) ex.getValue()).getValue();
return null;
}
@SuppressWarnings("unchecked")
public static PrimitiveType<Type> readPrimitiveExtension(DomainResource c, String uri) {
Extension ex = getExtension(c, uri);
if (ex == null)
return null;
return (PrimitiveType<Type>) ex.getValue();
}
public static boolean findStringExtension(Element c, String uri) {
Extension ex = ExtensionHelper.getExtension(c, uri);
if (ex == null)
return false;
if (!(ex.getValue() instanceof StringType))
return false;
return !Utilities.noString(((StringType) ex.getValue()).getValue());
}
public static Boolean readBooleanExtension(Element c, String uri) {
Extension ex = ExtensionHelper.getExtension(c, uri);
if (ex == null)
return null;
if (!(ex.getValue() instanceof BooleanType))
return null;
return ((BooleanType) ex.getValue()).getValue();
}
public static boolean findBooleanExtension(Element c, String uri) {
Extension ex = ExtensionHelper.getExtension(c, uri);
if (ex == null)
return false;
if (!(ex.getValue() instanceof BooleanType))
return false;
return true;
}
public static String getComment(ConceptDefinitionComponent c) {
return readStringExtension(c, EXT_COMMENT);
}
public static Boolean getDeprecated(Element c) {
return readBooleanExtension(c, EXT_DEPRECATED);
}
public static boolean hasComment(ConceptDefinitionComponent c) {
return findStringExtension(c, EXT_COMMENT);
}
public static boolean hasDeprecated(Element c) {
return findBooleanExtension(c, EXT_DEPRECATED);
}
public static List<CodeType> getSubsumes(ConceptDefinitionComponent c) {
List<CodeType> res = new ArrayList<CodeType>();
for (Extension e : c.getExtension()) {
if (EXT_SUBSUMES.equals(e.getUrl()))
res.add((CodeType) e.getValue());
}
return res;
}
public static void addFlyOver(GroupComponent group, String text) {
if (!Utilities.noString(text))
group.getExtension().add(Factory.newExtension(EXT_FLYOVER, Factory.newString_(text), true));
}
public static void setQuestionType(GroupComponent group, String text) {
if (!Utilities.noString(text))
group.getExtension().add(Factory.newExtension(EXT_QTYPE, Factory.newString_(text), true));
}
public static void setQuestionReference(GroupComponent group, String text) {
if (!Utilities.noString(text))
group.getExtension().add(Factory.newExtension(EXT_QREF, Factory.newString_(text), true));
}
public static void addFlyOver(Element element, String text) {
element.getExtension().add(Factory.newExtension(EXT_FLYOVER, Factory.newString_(text), true));
}
public static void addFilterOnly(Reference element, boolean value) {
element.getExtension().add(Factory.newExtension(EXTENSION_FILTER_ONLY, Factory.newBoolean(value), true));
}
public static void addType(GroupComponent group, String value) {
group.getExtension().add(Factory.newExtension(EXT_TYPE, Factory.newString_(value), true));
}
public static void addReference(QuestionComponent group, String value) {
group.getExtension().add(Factory.newExtension(EXT_REFERENCE, Factory.newString_(value), true));
}
public static void addIdentifier(Element element, Identifier value) {
element.getExtension().add(Factory.newExtension(EXT_IDENTIFIER, value, true));
}
/**
* @param name the identity of the extension of interest
* @return The extension, if on this element, else null
*/
public static Extension getExtension(DomainResource resource, String name) {
if (name == null)
return null;
if (!resource.hasExtension())
return null;
for (Extension e : resource.getExtension()) {
if (name.equals(e.getUrl()))
return e;
}
return null;
}
public static Extension getExtension(Element el, String name) {
if (name == null)
return null;
if (!el.hasExtension())
return null;
for (Extension e : el.getExtension()) {
if (name.equals(e.getUrl()))
return e;
}
return null;
}
public static void setStringExtension(DomainResource resource, String uri, String value) {
Extension ext = getExtension(resource, uri);
if (ext != null)
ext.setValue(new StringType(value));
else
resource.getExtension().add(new Extension(new UriType(uri)).setValue(new StringType(value)));
}
public static String getOID(ValueSetCodeSystemComponent define) {
return readStringExtension(define, EXT_OID);
}
public static String getOID(ValueSet vs) {
return readStringExtension(vs, EXT_OID);
}
public static void setOID(ValueSetCodeSystemComponent define, String oid) throws FHIRFormatError, URISyntaxException {
if (!oid.startsWith("urn:oid:"))
throw new FHIRFormatError("Error in OID format");
if (oid.startsWith("urn:oid:urn:oid:"))
throw new FHIRFormatError("Error in OID format");
define.getExtension().add(Factory.newExtension(EXT_OID, Factory.newUri(oid), false));
}
public static void setOID(ValueSet vs, String oid) throws FHIRFormatError, URISyntaxException {
if (!oid.startsWith("urn:oid:"))
throw new FHIRFormatError("Error in OID format");
if (oid.startsWith("urn:oid:urn:oid:"))
throw new FHIRFormatError("Error in OID format");
vs.getExtension().add(Factory.newExtension(EXT_OID, Factory.newUri(oid), false));
}
public static boolean hasLanguageTranslation(Element element, String lang) {
for (Extension e : element.getExtension()) {
if (e.getUrl().equals(EXT_TRANSLATION)) {
Extension e1 = ExtensionHelper.getExtension(e, "lang");
if (e1 != null && e1.getValue() instanceof CodeType && ((CodeType) e.getValue()).getValue().equals(lang))
return true;
}
}
return false;
}
public static String getLanguageTranslation(Element element, String lang) {
for (Extension e : element.getExtension()) {
if (e.getUrl().equals(EXT_TRANSLATION)) {
Extension e1 = ExtensionHelper.getExtension(e, "lang");
if (e1 != null && e1.getValue() instanceof CodeType && ((CodeType) e.getValue()).getValue().equals(lang)) {
e1 = ExtensionHelper.getExtension(e, "content");
return ((StringType) e.getValue()).getValue();
}
}
}
return null;
}
public static void addLanguageTranslation(Element element, String lang, String value) {
Extension extension = new Extension().setUrl(EXT_TRANSLATION);
extension.addExtension().setUrl("lang").setValue(new StringType(lang));
extension.addExtension().setUrl("content").setValue(new StringType(value));
element.getExtension().add(extension);
}
public static Type getAllowedUnits(ElementDefinition eld) {
for (Extension e : eld.getExtension())
if (e.getUrl().equals(EXT_ALLOWABLE_UNITS))
return e.getValue();
return null;
}
public static void setAllowableUnits(ElementDefinition eld, CodeableConcept cc) {
for (Extension e : eld.getExtension())
if (e.getUrl().equals(EXT_ALLOWABLE_UNITS)) {
e.setValue(cc);
return;
}
eld.getExtension().add(new Extension().setUrl(EXT_ALLOWABLE_UNITS).setValue(cc));
}
public static List<Extension> getExtensions(Element element, String url) {
List<Extension> results = new ArrayList<Extension>();
for (Extension ex : element.getExtension())
if (ex.getUrl().equals(url))
results.add(ex);
return results;
}
public static List<Extension> getExtensions(DomainResource resource, String url) {
List<Extension> results = new ArrayList<Extension>();
for (Extension ex : resource.getExtension())
if (ex.getUrl().equals(url))
results.add(ex);
return results;
}
public static void addDEReference(DataElement de, String value) {
for (Extension e : de.getExtension())
if (e.getUrl().equals(EXT_CIMI_REFERENCE)) {
e.setValue(new UriType(value));
return;
}
de.getExtension().add(new Extension().setUrl(EXT_CIMI_REFERENCE).setValue(new UriType(value)));
}
public static void setDeprecated(Element nc) {
for (Extension e : nc.getExtension())
if (e.getUrl().equals(EXT_DEPRECATED)) {
e.setValue(new BooleanType(true));
return;
}
nc.getExtension().add(new Extension().setUrl(EXT_DEPRECATED).setValue(new BooleanType(true)));
}
public static void setExtension(Element focus, String url, Coding c) {
for (Extension e : focus.getExtension())
if (e.getUrl().equals(url)) {
e.setValue(c);
return;
}
focus.getExtension().add(new Extension().setUrl(url).setValue(c));
}
public static void removeExtension(DomainResource focus, String url) {
Iterator<Extension> i = focus.getExtension().iterator();
while (i.hasNext()) {
Extension e = i.next(); // must be called before you can call i.remove()
if (e.getUrl().equals(url)) {
i.remove();
}
}
}
public static void removeExtension(Element focus, String url) {
Iterator<Extension> i = focus.getExtension().iterator();
while (i.hasNext()) {
Extension e = i.next(); // must be called before you can call i.remove()
if (e.getUrl().equals(url)) {
i.remove();
}
}
}
}

View File

@ -64,6 +64,9 @@ import org.apache.http.client.utils.URLEncodedUtils;
import org.hl7.fhir.instance.model.api.*;
import org.hl7.fhir.r4.model.BaseResource;
import org.hl7.fhir.r4.model.Bundle.HTTPVerb;
import org.hl7.fhir.r4.model.CanonicalType;
import org.hl7.fhir.r4.model.IdType;
import org.hl7.fhir.r4.model.Reference;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.PlatformTransactionManager;
@ -311,6 +314,10 @@ public abstract class BaseHapiFhirDao<T extends IBaseResource> implements IDao {
nextObject = ((IBaseExtension<?, ?>) nextObject).getValue();
}
if (nextObject instanceof CanonicalType) {
nextObject = new Reference(((CanonicalType) nextObject).getValueAsString());
}
IIdType nextId;
if (nextObject instanceof IBaseReference) {
IBaseReference nextValue = (IBaseReference) nextObject;

View File

@ -837,9 +837,7 @@ public class SearchBuilder implements ISearchBuilder {
Predicate orPredicate = myBuilder.or(toArray(codePredicates));
Predicate paramNamePredicate = myBuilder.equal(join.get("myParamName"), theParamName);
Predicate outerPredicate = myBuilder.and(paramNamePredicate, orPredicate);
Predicate outerPredicate = combineParamIndexPredicateWithParamNamePredicate(theResourceName, theParamName, join, orPredicate);
myPredicates.add(outerPredicate);
}
@ -1195,7 +1193,7 @@ public class SearchBuilder implements ISearchBuilder {
for (VersionIndependentConcept nextCode : codes) {
List<VersionIndependentConcept> systemCodes = map.get(nextCode.getSystem());
if (null == systemCodes) {
systemCodes = new ArrayList<VersionIndependentConcept>();
systemCodes = new ArrayList<>();
map.put(nextCode.getSystem(), systemCodes);
}
systemCodes.add(nextCode);

View File

@ -31,6 +31,7 @@ import ca.uhn.fhir.util.DatatypeUtil;
import org.hl7.fhir.instance.model.api.IIdType;
import org.hl7.fhir.instance.model.api.IPrimitiveType;
import org.hl7.fhir.r4.model.Extension;
import org.hl7.fhir.r4.model.Reference;
import org.hl7.fhir.r4.model.SearchParameter;
import org.springframework.beans.factory.annotation.Autowired;
@ -129,7 +130,7 @@ public class SearchParamRegistryR4 extends BaseSearchParamRegistry<SearchParamet
List<JpaRuntimeSearchParam.Component> components = new ArrayList<>();
for (org.hl7.fhir.r4.model.SearchParameter.SearchParameterComponentComponent next : theNextSp.getComponent()) {
components.add(new JpaRuntimeSearchParam.Component(next.getExpression(), next.getDefinition()));
components.add(new JpaRuntimeSearchParam.Component(next.getExpression(), new Reference(next.getDefinition())));
}
return new JpaRuntimeSearchParam(id, uri, name, description, path, paramType, providesMembershipInCompartments, targets, status, unique, components, theNextSp.getBase());

View File

@ -75,6 +75,7 @@ public class FhirResourceDaoR4SearchPageExpiryTest extends BaseJpaR4Test {
myDaoConfig.setExpireSearchResultsAfterMillis(1000L);
myDaoConfig.setReuseCachedSearchResultsForMillis(500L);
long start = System.currentTimeMillis();
StaleSearchDeletingSvcImpl.setNowForUnitTests(start);
final String searchUuid1;
{

View File

@ -171,8 +171,8 @@ public class FhirResourceDaoR4Test extends BaseJpaR4Test {
});
}
private List<UriType> sortIds(List<UriType> theProfiles) {
ArrayList<UriType> retVal = new ArrayList<UriType>(theProfiles);
private List<CanonicalType> sortIds(List<CanonicalType> theProfiles) {
ArrayList<CanonicalType> retVal = new ArrayList<>(theProfiles);
Collections.sort(retVal, new Comparator<UriType>() {
@Override
public int compare(UriType theO1, UriType theO2) {
@ -1346,7 +1346,7 @@ public class FhirResourceDaoR4Test extends BaseJpaR4Test {
Organization org = new Organization();
org.getMeta().getProfile().add(new IdType("http://foo"));
org.getMeta().getProfile().add(new CanonicalType("http://foo"));
org.setName(methodName);
IIdType orgId = myOrganizationDao.create(org, mySrd).getId().toUnqualifiedVersionless();
@ -2552,7 +2552,7 @@ public class FhirResourceDaoR4Test extends BaseJpaR4Test {
assertEquals("seclabel:sys:2", secLabels.get(1).getSystemElement().getValue());
assertEquals("seclabel:code:2", secLabels.get(1).getCodeElement().getValue());
assertEquals("seclabel:dis:2", secLabels.get(1).getDisplayElement().getValue());
List<UriType> profiles = meta.getProfile();
List<CanonicalType> profiles = meta.getProfile();
assertEquals(2, profiles.size());
assertEquals("http://profile/1", profiles.get(0).getValue());
assertEquals("http://profile/2", profiles.get(1).getValue());
@ -2683,7 +2683,7 @@ public class FhirResourceDaoR4Test extends BaseJpaR4Test {
assertEquals("seclabel:sys:2", secLabels.get(1).getSystemElement().getValue());
assertEquals("seclabel:code:2", secLabels.get(1).getCodeElement().getValue());
assertEquals("seclabel:dis:2", secLabels.get(1).getDisplayElement().getValue());
List<UriType> profiles = meta.getProfile();
List<CanonicalType> profiles = meta.getProfile();
assertEquals(2, profiles.size());
assertEquals("http://profile/1", profiles.get(0).getValue());
assertEquals("http://profile/2", profiles.get(1).getValue());
@ -2784,7 +2784,7 @@ public class FhirResourceDaoR4Test extends BaseJpaR4Test {
assertEquals("seclabel:sys:2", secLabels.get(1).getSystemElement().getValue());
assertEquals("seclabel:code:2", secLabels.get(1).getCodeElement().getValue());
assertEquals("seclabel:dis:2", secLabels.get(1).getDisplayElement().getValue());
List<UriType> profiles = meta.getProfile();
List<CanonicalType> profiles = meta.getProfile();
assertEquals(2, profiles.size());
assertEquals("http://profile/1", profiles.get(0).getValue());
assertEquals("http://profile/2", profiles.get(1).getValue());
@ -3489,9 +3489,9 @@ public class FhirResourceDaoR4Test extends BaseJpaR4Test {
securityLabels.add(new Coding().setSystem("seclabel:sys:2").setCode("seclabel:code:2").setDisplay("seclabel:dis:2"));
patient.getMeta().getSecurity().addAll(securityLabels);
List<UriType> profiles = new ArrayList<UriType>();
profiles.add(new IdType("http://profile/1"));
profiles.add(new IdType("http://profile/2"));
List<CanonicalType> profiles = new ArrayList<>();
profiles.add(new CanonicalType("http://profile/1"));
profiles.add(new CanonicalType("http://profile/2"));
patient.getMeta().getProfile().addAll(profiles);
MethodOutcome outcome = myPatientDao.create(patient, mySrd);
@ -3697,7 +3697,7 @@ public class FhirResourceDaoR4Test extends BaseJpaR4Test {
"Unable to delete [a-zA-Z]+/[0-9]+ because at least one resource has a reference to this resource. First reference found was resource [a-zA-Z]+/[0-9]+ in path [a-zA-Z]+.[a-zA-Z]+"));
}
private static List<String> toStringList(List<UriType> theUriType) {
private static List<String> toStringList(List<CanonicalType> theUriType) {
ArrayList<String> retVal = new ArrayList<String>();
for (UriType next : theUriType) {
retVal.add(next.getValue());

View File

@ -75,10 +75,10 @@ public class FhirResourceDaoR4UniqueSearchParamTest extends BaseJpaR4Test {
sp.addBase("Patient");
sp.addComponent()
.setExpression("Patient")
.setDefinition(new Reference("SearchParameter/patient-gender"));
.setDefinition("SearchParameter/patient-gender");
sp.addComponent()
.setExpression("Patient")
.setDefinition(new Reference("SearchParameter/patient-birthdate"));
.setDefinition("SearchParameter/patient-birthdate");
sp.addExtension()
.setUrl(JpaConstants.EXT_SP_UNIQUE)
.setValue(new BooleanType(true));
@ -116,10 +116,10 @@ public class FhirResourceDaoR4UniqueSearchParamTest extends BaseJpaR4Test {
sp.addBase("Coverage");
sp.addComponent()
.setExpression("Coverage")
.setDefinition(new Reference("/SearchParameter/coverage-beneficiary"));
.setDefinition("/SearchParameter/coverage-beneficiary");
sp.addComponent()
.setExpression("Coverage")
.setDefinition(new Reference("/SearchParameter/coverage-identifier"));
.setDefinition("/SearchParameter/coverage-identifier");
sp.addExtension()
.setUrl(JpaConstants.EXT_SP_UNIQUE)
.setValue(new BooleanType(true));
@ -148,7 +148,7 @@ public class FhirResourceDaoR4UniqueSearchParamTest extends BaseJpaR4Test {
sp.addBase("Observation");
sp.addComponent()
.setExpression("Observation")
.setDefinition(new Reference("/SearchParameter/observation-subject"));
.setDefinition("/SearchParameter/observation-subject");
sp.addExtension()
.setUrl(JpaConstants.EXT_SP_UNIQUE)
.setValue(new BooleanType(true));
@ -177,7 +177,7 @@ public class FhirResourceDaoR4UniqueSearchParamTest extends BaseJpaR4Test {
sp.addBase("Patient");
sp.addComponent()
.setExpression("Patient")
.setDefinition(new Reference("/SearchParameter/patient-identifier"));
.setDefinition("/SearchParameter/patient-identifier");
sp.addExtension()
.setUrl(JpaConstants.EXT_SP_UNIQUE)
.setValue(new BooleanType(true));
@ -206,7 +206,7 @@ public class FhirResourceDaoR4UniqueSearchParamTest extends BaseJpaR4Test {
sp.addBase("Patient");
sp.addComponent()
.setExpression("Patient")
.setDefinition(new Reference("/SearchParameter/patient-identifier"));
.setDefinition("/SearchParameter/patient-identifier");
sp.addExtension()
.setUrl(JpaConstants.EXT_SP_UNIQUE)
.setValue(new BooleanType(true));
@ -240,10 +240,10 @@ public class FhirResourceDaoR4UniqueSearchParamTest extends BaseJpaR4Test {
sp.addBase("Patient");
sp.addComponent()
.setExpression("Patient")
.setDefinition(new Reference("SearchParameter/patient-name"));
.setDefinition("SearchParameter/patient-name");
sp.addComponent()
.setExpression("Patient")
.setDefinition(new Reference("SearchParameter/patient-organization"));
.setDefinition("SearchParameter/patient-organization");
sp.addExtension()
.setUrl(JpaConstants.EXT_SP_UNIQUE)
.setValue(new BooleanType(true));
@ -289,13 +289,13 @@ public class FhirResourceDaoR4UniqueSearchParamTest extends BaseJpaR4Test {
sp.setExpression("Observation.code");
sp.addComponent()
.setExpression("Observation")
.setDefinition(new Reference("SearchParameter/obs-subject"));
.setDefinition("SearchParameter/obs-subject");
sp.addComponent()
.setExpression("Observation")
.setDefinition(new Reference("SearchParameter/obs-effective"));
.setDefinition("SearchParameter/obs-effective");
sp.addComponent()
.setExpression("Observation")
.setDefinition(new Reference("SearchParameter/obs-code"));
.setDefinition("SearchParameter/obs-code");
sp.addExtension()
.setUrl(JpaConstants.EXT_SP_UNIQUE)
.setValue(new BooleanType(true));

View File

@ -36,7 +36,7 @@ public class FhirResourceDaoR4UpdateTest extends BaseJpaR4Test {
}
@Test
public void testCreateAndUpdateWithoutRequest() throws Exception {
public void testCreateAndUpdateWithoutRequest() {
String methodName = "testUpdateByUrl";
Patient p = new Patient();
@ -85,10 +85,10 @@ public class FhirResourceDaoR4UpdateTest extends BaseJpaR4Test {
Patient patient = new Patient();
patient.addName().setFamily(name);
List<IdType> tl = new ArrayList<IdType>();
tl.add(new IdType("http://foo/bar"));
tl.add(new IdType("http://foo/bar"));
tl.add(new IdType("http://foo/bar"));
List<CanonicalType> tl = new ArrayList<>();
tl.add(new CanonicalType("http://foo/bar"));
tl.add(new CanonicalType("http://foo/bar"));
tl.add(new CanonicalType("http://foo/bar"));
patient.getMeta().getProfile().addAll(tl);
id = myPatientDao.create(patient, mySrd).getId().toUnqualifiedVersionless();
@ -97,7 +97,7 @@ public class FhirResourceDaoR4UpdateTest extends BaseJpaR4Test {
// Do a read
{
Patient patient = myPatientDao.read(id, mySrd);
List<UriType> tl = patient.getMeta().getProfile();
List<CanonicalType> tl = patient.getMeta().getProfile();
assertEquals(1, tl.size());
assertEquals("http://foo/bar", tl.get(0).getValue());
}
@ -584,7 +584,7 @@ public class FhirResourceDaoR4UpdateTest extends BaseJpaR4Test {
secListValues.add(next.getSystemElement().getValue() + "|" + next.getCodeElement().getValue());
}
assertThat(secListValues, containsInAnyOrder("sec_scheme1|sec_term1", "sec_scheme2|sec_term2"));
List<UriType> profileList = p1.getMeta().getProfile();
List<CanonicalType> profileList = p1.getMeta().getProfile();
assertEquals(1, profileList.size());
assertEquals("http://foo2", profileList.get(0).getValueAsString()); // no foo1
}
@ -598,8 +598,8 @@ public class FhirResourceDaoR4UpdateTest extends BaseJpaR4Test {
Patient patient = new Patient();
patient.addName().setFamily(name);
List<IdType> tl = new ArrayList<IdType>();
tl.add(new IdType("http://foo/bar"));
List<CanonicalType> tl = new ArrayList<>();
tl.add(new CanonicalType("http://foo/bar"));
patient.getMeta().getProfile().addAll(tl);
id = myPatientDao.create(patient, mySrd).getId().toUnqualifiedVersionless();
@ -608,7 +608,7 @@ public class FhirResourceDaoR4UpdateTest extends BaseJpaR4Test {
// Do a read
{
Patient patient = myPatientDao.read(id, mySrd);
List<UriType> tl = patient.getMeta().getProfile();
List<CanonicalType> tl = patient.getMeta().getProfile();
assertEquals(1, tl.size());
assertEquals("http://foo/bar", tl.get(0).getValue());
}
@ -619,8 +619,8 @@ public class FhirResourceDaoR4UpdateTest extends BaseJpaR4Test {
patient.setId(id);
patient.addName().setFamily(name);
List<IdType> tl = new ArrayList<IdType>();
tl.add(new IdType("http://foo/baz"));
List<CanonicalType> tl = new ArrayList<>();
tl.add(new CanonicalType("http://foo/baz"));
patient.getMeta().getProfile().clear();
patient.getMeta().getProfile().addAll(tl);
@ -630,7 +630,7 @@ public class FhirResourceDaoR4UpdateTest extends BaseJpaR4Test {
// Do a read
{
Patient patient = myPatientDao.read(id, mySrd);
List<UriType> tl = patient.getMeta().getProfile();
List<CanonicalType> tl = patient.getMeta().getProfile();
assertEquals(1, tl.size());
assertEquals("http://foo/baz", tl.get(0).getValue());
}

View File

@ -30,7 +30,7 @@ public class FhirResourceDaoR4ValidateTest extends BaseJpaR4Test {
@Test
public void testValidateStructureDefinition() throws Exception {
String input = IOUtils.toString(getClass().getResourceAsStream("/sd-david-dhtest7.json"), StandardCharsets.UTF_8);
String input = IOUtils.toString(getClass().getResourceAsStream("/r4/sd-david-dhtest7.json"), StandardCharsets.UTF_8);
StructureDefinition sd = myFhirCtx.newJsonParser().parseResource(StructureDefinition.class, input);
@ -114,7 +114,7 @@ public class FhirResourceDaoR4ValidateTest extends BaseJpaR4Test {
myStructureDefinitionDao.create(sd, mySrd);
Observation input = new Observation();
input.getMeta().getProfile().add(new IdType(sd.getUrl()));
input.getMeta().getProfile().add(new CanonicalType(sd.getUrl()));
input.addIdentifier().setSystem("http://acme").setValue("12345");
input.getContext().setReference("http://foo.com/Encounter/9");
@ -154,7 +154,7 @@ public class FhirResourceDaoR4ValidateTest extends BaseJpaR4Test {
Observation input = new Observation();
String profileUri = "http://example.com/" + methodName;
input.getMeta().getProfile().add(new IdType(profileUri));
input.getMeta().getProfile().add(new CanonicalType(profileUri));
input.addIdentifier().setSystem("http://acme").setValue("12345");
input.getContext().setReference("http://foo.com/Encounter/9");

View File

@ -528,7 +528,7 @@ public class FhirSystemDaoR4Test extends BaseJpaR4SystemTest {
patient.getMeta().addTag(null, "Dog", "Puppies");
patient.getMeta().getSecurity().add(new Coding().setSystem("seclabel:sys:1").setCode("seclabel:code:1").setDisplay("seclabel:dis:1"));
patient.getMeta().getProfile().add(new IdType("http://profile/1"));
patient.getMeta().getProfile().add(new CanonicalType("http://profile/1"));
id1 = myPatientDao.create(patient, mySrd).getId();
}
@ -539,7 +539,7 @@ public class FhirSystemDaoR4Test extends BaseJpaR4SystemTest {
patient.getMeta().addTag("http://foo", "Cat", "Kittens");
patient.getMeta().getSecurity().add(new Coding().setSystem("seclabel:sys:2").setCode("seclabel:code:2").setDisplay("seclabel:dis:2"));
patient.getMeta().getProfile().add(new IdType("http://profile/2"));
patient.getMeta().getProfile().add(new CanonicalType("http://profile/2"));
myPatientDao.create(patient, mySrd);
}
@ -561,7 +561,7 @@ public class FhirSystemDaoR4Test extends BaseJpaR4SystemTest {
assertEquals("seclabel:sys:2", secLabels.get(1).getSystemElement().getValue());
assertEquals("seclabel:code:2", secLabels.get(1).getCodeElement().getValue());
assertEquals("seclabel:dis:2", secLabels.get(1).getDisplayElement().getValue());
List<UriType> profiles = meta.getProfile();
List<CanonicalType> profiles = meta.getProfile();
assertEquals(2, profiles.size());
assertEquals("http://profile/1", profiles.get(0).getValue());
assertEquals("http://profile/2", profiles.get(1).getValue());

View File

@ -81,6 +81,7 @@ public class ResourceProviderQuestionnaireResponseDstu3Test extends BaseResource
@SuppressWarnings("unused")
@Test
@Ignore
public void testCreateWithAbsoluteReference() {
Patient pt1 = new Patient();
pt1.addName().setFamily("Everything").addGiven("Arthur");
@ -91,7 +92,7 @@ public class ResourceProviderQuestionnaireResponseDstu3Test extends BaseResource
IIdType qId = myQuestionnaireDao.create(q1, mySrd).getId().toUnqualifiedVersionless();
QuestionnaireResponse qr1 = new QuestionnaireResponse();
qr1.getQuestionnaire().setReferenceElement(qId.withServerBase("http://example.com", "Questionnaire"));
qr1.getQuestionnaire().setReferenceElement(qId.withServerBase(null, "Questionnaire"));
qr1.setStatus(QuestionnaireResponseStatus.COMPLETED);
qr1.addItem().setLinkId("link1").addAnswer().setValue(new DecimalType(123));
try {

View File

@ -68,7 +68,7 @@ public class ResourceProviderQuestionnaireResponseR4Test extends BaseResourcePro
IIdType qId = myQuestionnaireDao.create(q1, mySrd).getId().toUnqualifiedVersionless();
QuestionnaireResponse qr1 = new QuestionnaireResponse();
qr1.getQuestionnaire().setReferenceElement(qId);
qr1.setQuestionnaire(qId.getValue());
qr1.setStatus(QuestionnaireResponseStatus.COMPLETED);
qr1.addItem().setLinkId("link1").addAnswer().setValue(new DecimalType(123));
try {
@ -91,7 +91,7 @@ public class ResourceProviderQuestionnaireResponseR4Test extends BaseResourcePro
IIdType qId = myQuestionnaireDao.create(q1, mySrd).getId().toUnqualifiedVersionless();
QuestionnaireResponse qr1 = new QuestionnaireResponse();
qr1.getQuestionnaire().setReferenceElement(qId.withServerBase("http://example.com", "Questionnaire"));
qr1.setQuestionnaire(qId.withServerBase("http://example.com", "Questionnaire").getValue());
qr1.setStatus(QuestionnaireResponseStatus.COMPLETED);
qr1.addItem().setLinkId("link1").addAnswer().setValue(new DecimalType(123));
try {
@ -195,7 +195,7 @@ public class ResourceProviderQuestionnaireResponseR4Test extends BaseResourcePro
@Test
public void testValidateQuestionnaireResponseWithNoIdForCreate() throws Exception {
String input = "{\"resourceType\":\"Parameters\",\"parameter\":[{\"name\":\"mode\",\"valueString\":\"create\"},{\"name\":\"resource\",\"resource\":{\"resourceType\":\"QuestionnaireResponse\",\"questionnaire\":{\"reference\":\"http://fhirtest.uhn.ca/baseDstu2/Questionnaire/MedsCheckEligibility\"},\"text\":{\"status\":\"generated\",\"div\":\"<div xmlns=\\\"http://www.w3.org/1999/xhtml\\\">!-- populated from the rendered HTML below --></div>\"},\"status\":\"completed\",\"authored\":\"2017-02-10T00:02:58.098Z\"}}]}";
String input = "{\"resourceType\":\"Parameters\",\"parameter\":[{\"name\":\"mode\",\"valueString\":\"create\"},{\"name\":\"resource\",\"resource\":{\"resourceType\":\"QuestionnaireResponse\",\"questionnaire\":\"http://fhirtest.uhn.ca/baseDstu2/Questionnaire/MedsCheckEligibility\",\"text\":{\"status\":\"generated\",\"div\":\"<div xmlns=\\\"http://www.w3.org/1999/xhtml\\\">!-- populated from the rendered HTML below --></div>\"},\"status\":\"completed\",\"authored\":\"2017-02-10T00:02:58.098Z\"}}]}";
HttpPost post = new HttpPost(ourServerBase + "/QuestionnaireResponse/$validate?_pretty=true");
post.setEntity(new StringEntity(input, ContentType.APPLICATION_JSON));
CloseableHttpResponse response = ourHttpClient.execute(post);
@ -215,7 +215,7 @@ public class ResourceProviderQuestionnaireResponseR4Test extends BaseResourcePro
@Test
public void testValidateQuestionnaireResponseWithNoIdForUpdate() throws Exception {
String input = "{\"resourceType\":\"Parameters\",\"parameter\":[{\"name\":\"mode\",\"valueString\":\"update\"},{\"name\":\"resource\",\"resource\":{\"resourceType\":\"QuestionnaireResponse\",\"questionnaire\":{\"reference\":\"http://fhirtest.uhn.ca/baseDstu2/Questionnaire/MedsCheckEligibility\"},\"text\":{\"status\":\"generated\",\"div\":\"<div xmlns=\\\"http://www.w3.org/1999/xhtml\\\">!-- populated from the rendered HTML below --></div>\"},\"status\":\"completed\",\"authored\":\"2017-02-10T00:02:58.098Z\"}}]}";
String input = "{\"resourceType\":\"Parameters\",\"parameter\":[{\"name\":\"mode\",\"valueString\":\"update\"},{\"name\":\"resource\",\"resource\":{\"resourceType\":\"QuestionnaireResponse\",\"questionnaire\":\"http://fhirtest.uhn.ca/baseDstu2/Questionnaire/MedsCheckEligibility\",\"text\":{\"status\":\"generated\",\"div\":\"<div xmlns=\\\"http://www.w3.org/1999/xhtml\\\">!-- populated from the rendered HTML below --></div>\"},\"status\":\"completed\",\"authored\":\"2017-02-10T00:02:58.098Z\"}}]}";
HttpPost post = new HttpPost(ourServerBase + "/QuestionnaireResponse/$validate?_pretty=true");
post.setEntity(new StringEntity(input, ContentType.APPLICATION_JSON));
CloseableHttpResponse response = ourHttpClient.execute(post);

View File

@ -410,7 +410,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
IIdType optId = myClient.create().resource(options).execute().getId();
Questionnaire q = new Questionnaire();
q.addItem().setLinkId("link0").setRequired(false).setType(QuestionnaireItemType.CHOICE).setOptions(new Reference(optId));
q.addItem().setLinkId("link0").setRequired(false).setType(QuestionnaireItemType.CHOICE).setOptions((optId.getValue()));
IIdType qId = myClient.create().resource(q).execute().getId();
QuestionnaireResponse qa;
@ -418,14 +418,14 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
// Good code
qa = new QuestionnaireResponse();
qa.getQuestionnaire().setReference(qId.toUnqualifiedVersionless().getValue());
qa.setQuestionnaire(qId.toUnqualifiedVersionless().getValue());
qa.addItem().setLinkId("link0").addAnswer().setValue(new Coding().setSystem("urn:system").setCode("code0"));
myClient.create().resource(qa).execute();
// Bad code
qa = new QuestionnaireResponse();
qa.getQuestionnaire().setReference(qId.toUnqualifiedVersionless().getValue());
qa.setQuestionnaire(qId.toUnqualifiedVersionless().getValue());
qa.addItem().setLinkId("link0").addAnswer().setValue(new Coding().setSystem("urn:system").setCode("code1"));
try {
myClient.create().resource(qa).execute();
@ -1946,7 +1946,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
int initialSize = client.search().forResource(ImagingStudy.class).returnBundle(Bundle.class).execute().getEntry().size();
String resBody = IOUtils.toString(ResourceProviderR4Test.class.getResource("/imagingstudy.json"), StandardCharsets.UTF_8);
String resBody = IOUtils.toString(ResourceProviderR4Test.class.getResource("/r4/imagingstudy.json"), StandardCharsets.UTF_8);
client.create().resource(resBody).execute();
int newSize = client.search().forResource(ImagingStudy.class).returnBundle(Bundle.class).execute().getEntry().size();

View File

@ -94,9 +94,7 @@
</blockquote>
</div>
</text>
<questionnaire>
<reference value="Questionnaire/Questionnairegcs"/>
</questionnaire>
<questionnaire value="Questionnaire/Questionnairegcs"/>
<status value="completed"/>
<authored value="2014-12-11T04:44:16Z"/>
<item>
@ -350,23 +348,17 @@
<item>
<linkId value="1.1"/>
<type value="choice"/>
<options>
<reference value="#verbal"/>
</options>
<options value="#verbal"/>
</item>
<item>
<linkId value="1.2"/>
<type value="choice"/>
<options>
<reference value="#motor"/>
</options>
<options value="#motor"/>
</item>
<item>
<linkId value="1.3"/>
<type value="choice"/>
<options>
<reference value="#eye"/>
</options>
<options value="#eye"/>
</item>
</Questionnaire>
</resource>

View File

@ -339,12 +339,14 @@
}
]
},
"doseQuantity": {
"value": 1,
"unit": "tablet",
"system": "http://unitsofmeasure.org",
"code": "tbl"
}
"doseAndRate": [{
"doseQuantity": {
"value": 1,
"unit": "tablet",
"system": "http://unitsofmeasure.org",
"code": "tbl"
}
}]
}
]
}
@ -404,4 +406,4 @@
}
}
]
}
}

View File

@ -0,0 +1,17 @@
{
"resourceType": "ImagingStudy",
"text": {
"status": "generated",
"div": "<div xmlns=\"http://www.w3.org/1999/xhtml\">Image 1 from Series 3: CT Images on Patient MINT (MINT1234) taken at 1-Jan 2011 01:20 AM</div>"
},
"numberOfSeries": 1,
"numberOfInstances": 1,
"series": [{
"number": 3,
"description": "CT Surview 180",
"numberOfInstances": 1,
"instance": [{
"number": 1
}]
}]
}

View File

@ -0,0 +1,228 @@
{
"resourceType": "StructureDefinition",
"id": "dhtest7",
"meta": {
"versionId": "2",
"lastUpdated": "2016-09-01T03:05:36.257-04:00"
},
"url": "http://fhirtest.uhn.ca/baseDstu3/StructureDefinition/dhtest7",
"name": "dhtest7",
"status": "draft",
"experimental": true,
"description": "Base StructureDefinition for Basic Resource",
"kind": "resource",
"abstract": false,
"baseDefinition": "http://hl7.org/fhir/StructureDefinition/Basic",
"derivation": "constraint",
"snapshot": {
"element": [
{
"path": "Basic",
"short": "Resource for non-supported content",
"definition": "Basic is used for handling concepts not yet defined in FHIR, narrative-only resources that don't map to an existing resource, and custom resources not appropriate for inclusion in the FHIR specification.",
"alias": [
"Z-resource",
"Extension-resource",
"Custom-resource"
],
"min": 0,
"max": "*",
"type": [
{
"code": "DomainResource"
}
],
"isSummary": true,
"mapping": [
{
"identity": "rim",
"map": "Act, Entity or Role"
},
{
"identity": "w5",
"map": "infrastructure.structure"
}
]
},
{
"path": "Basic.id",
"definition": "Id",
"min": 0,
"max": "1",
"base": {
"path": "Resource.id",
"min": 0,
"max": "1"
},
"type": [
{
"code": "id"
}
]
},
{
"path": "Basic.meta",
"definition": "The meta element",
"min": 0,
"max": "1",
"base": {
"path": "Resource.meta",
"min": 0,
"max": "1"
},
"type": [
{
"code": "Meta"
}
]
},
{
"path": "Basic.text",
"definition": "Narrative",
"min": 0,
"max": "1",
"base": {
"path": "DomainResource.text",
"min": 0,
"max": "*"
},
"type": [
{
"code": "Narrative"
}
]
},
{
"path": "Basic.identifier",
"short": "Business identifier",
"definition": "Identifier assigned to the resource for business purposes, outside the context of FHIR.",
"min": 0,
"max": "*",
"type": [
{
"code": "Identifier"
}
],
"isSummary": true,
"mapping": [
{
"identity": "rim",
"map": "./identifier"
},
{
"identity": "w5",
"map": "id"
}
]
},
{
"path": "Basic.code",
"short": "Kind of Resource",
"definition": "Identifies the 'type' of resource - equivalent to the resource name for other resources.",
"min": 1,
"max": "1",
"type": [
{
"code": "CodeableConcept"
}
],
"isModifier": true,
"isSummary": true,
"binding": {
"strength": "example",
"description": "Codes for identifying types of resources not yet defined by FHIR",
"valueSetCanonical": "http://hl7.org/fhir/ValueSet/basic-resource-type"
},
"mapping": [
{
"identity": "rim",
"map": "./code"
},
{
"identity": "w5",
"map": "what"
}
]
},
{
"path": "Basic.subject",
"short": "Identifies the focus of this resource",
"definition": "Identifies the patient, practitioner, device or any other resource that is the \"focus\" of this resource.",
"min": 0,
"max": "1",
"type": [
{
"code": "Reference",
"profile": "http://hl7.org/fhir/StructureDefinition/Resource"
}
],
"isSummary": true,
"mapping": [
{
"identity": "rim",
"map": "./participation[typeCode='SBJ'] (possibly through a ControlAct and Role)"
},
{
"identity": "w5",
"map": "who.focus"
}
]
},
{
"path": "Basic.created",
"short": "When created",
"definition": "Identifies when the resource was first created.",
"min": 0,
"max": "1",
"type": [
{
"code": "date"
}
],
"isSummary": true,
"mapping": [
{
"identity": "rim",
"map": "./participation[typeCode='AUT']/time (possibly through a ControlAct and Role)"
},
{
"identity": "w5",
"map": "when.recorded"
}
]
},
{
"path": "Basic.author",
"short": "Who created",
"definition": "Indicates who was responsible for creating the resource instance.",
"min": 0,
"max": "1",
"type": [
{
"code": "Reference",
"profile": "http://hl7.org/fhir/StructureDefinition/Practitioner"
},
{
"code": "Reference",
"profile": "http://hl7.org/fhir/StructureDefinition/Patient"
},
{
"code": "Reference",
"profile": "http://hl7.org/fhir/StructureDefinition/RelatedPerson"
}
],
"isSummary": true,
"mapping": [
{
"identity": "rim",
"map": "./participation[typeCode='SUB'] (possibly through a ControlAct and Role)"
},
{
"identity": "w5",
"map": "who.author"
}
]
}
]
}
}

View File

@ -1,472 +1,500 @@
package org.hl7.fhir.dstu2016may.utils;
import org.apache.commons.lang3.StringUtils;
import org.hl7.fhir.dstu2016may.model.*;
import org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionComponent;
import org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemComponent;
import org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType;
import org.hl7.fhir.exceptions.FHIRFormatError;
import org.hl7.fhir.utilities.validation.ValidationMessage;
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
/*
Copyright (c) 2011+, HL7, Inc
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of HL7 nor the names of its contributors may be used to
endorse or promote products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
public class ToolingExtensions {
// validated
public static final String EXT_SUBSUMES = "http://hl7.org/fhir/StructureDefinition/codesystem-subsumes";
private static final String EXT_OID = "http://hl7.org/fhir/StructureDefinition/valueset-oid";
// public static final String EXT_DEPRECATED = "http://hl7.org/fhir/StructureDefinition/codesystem-deprecated";
public static final String EXT_DEFINITION = "http://hl7.org/fhir/StructureDefinition/valueset-definition";
public static final String EXT_COMMENT = "http://hl7.org/fhir/StructureDefinition/valueset-comments";
private static final String EXT_IDENTIFIER = "http://hl7.org/fhir/StructureDefinition/identifier";
private static final String EXT_TRANSLATION = "http://hl7.org/fhir/StructureDefinition/translation";
public static final String EXT_ISSUE_SOURCE = "http://hl7.org/fhir/StructureDefinition/operationoutcome-issue-source";
public static final String EXT_DISPLAY_HINT = "http://hl7.org/fhir/StructureDefinition/structuredefinition-display-hint";
public static final String EXT_REPLACED_BY = "http://hl7.org/fhir/StructureDefinition/valueset-replacedby";
public static final String EXT_JSON_TYPE = "http://hl7.org/fhir/StructureDefinition/structuredefinition-json-type";
public static final String EXT_XML_TYPE = "http://hl7.org/fhir/StructureDefinition/structuredefinition-xml-type";
public static final String EXT_REGEX = "http://hl7.org/fhir/StructureDefinition/structuredefinition-regex";
public static final String EXT_CONTROL = "http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl";
public static final String EXT_MINOCCURS = "http://hl7.org/fhir/StructureDefinition/questionnaire-minOccurs";
public static final String EXT_MAXOCCURS = "http://hl7.org/fhir/StructureDefinition/questionnaire-maxOccurs";
public static final String EXT_ALLOWEDRESOURCE = "http://hl7.org/fhir/StructureDefinition/questionnaire-allowedResource";
public static final String EXT_REFERENCEFILTER = "http://hl7.org/fhir/StructureDefinition/questionnaire-referenceFilter";
// unregistered?
// public static final String EXT_FLYOVER = "http://hl7.org/fhir/Profile/questionnaire-extensions#flyover";
// private static final String EXT_QTYPE = "http://www.healthintersections.com.au/fhir/Profile/metadata#type";
// private static final String EXT_QREF = "http://www.healthintersections.com.au/fhir/Profile/metadata#reference";
// private static final String EXTENSION_FILTER_ONLY = "http://www.healthintersections.com.au/fhir/Profile/metadata#expandNeedsFilter";
// private static final String EXT_TYPE = "http://www.healthintersections.com.au/fhir/Profile/metadata#type";
// private static final String EXT_REFERENCE = "http://www.healthintersections.com.au/fhir/Profile/metadata#reference";
private static final String EXT_FHIRTYPE = "http://hl7.org/fhir/StructureDefinition/questionnaire-fhirType";
private static final String EXT_ALLOWABLE_UNITS = "http://hl7.org/fhir/StructureDefinition/elementdefinition-allowedUnits";
public static final String EXT_CIMI_REFERENCE = "http://hl7.org/fhir/StructureDefinition/cimi-reference";
public static final String EXT_UNCLOSED = "http://hl7.org/fhir/StructureDefinition/valueset-unclosed";
public static final String EXT_FMM_LEVEL = "http://hl7.org/fhir/StructureDefinition/structuredefinition-fmm";
// specific extension helpers
public static Extension makeIssueSource(ValidationMessage.Source source) {
Extension ex = new Extension();
// todo: write this up and get it published with the pack (and handle the redirect?)
ex.setUrl(ToolingExtensions.EXT_ISSUE_SOURCE);
CodeType c = new CodeType();
c.setValue(source.toString());
ex.setValue(c);
return ex;
}
public static boolean hasExtension(DomainResource de, String url) {
return getExtension(de, url) != null;
}
public static boolean hasExtension(Element e, String url) {
return getExtension(e, url) != null;
}
public static void addStringExtension(DomainResource dr, String url, String content) {
if (!StringUtils.isBlank(content)) {
Extension ex = getExtension(dr, url);
if (ex != null)
ex.setValue(new StringType(content));
else
dr.getExtension().add(Factory.newExtension(url, new StringType(content), true));
}
}
public static void addMarkdownExtension(DomainResource dr, String url, String content) {
if (!StringUtils.isBlank(content)) {
Extension ex = getExtension(dr, url);
if (ex != null)
ex.setValue(new StringType(content));
else
dr.getExtension().add(Factory.newExtension(url, new MarkdownType(content), true));
}
}
public static void addStringExtension(Element e, String url, String content) {
if (!StringUtils.isBlank(content)) {
Extension ex = getExtension(e, url);
if (ex != null)
ex.setValue(new StringType(content));
else
e.getExtension().add(Factory.newExtension(url, new StringType(content), true));
}
}
public static void addIntegerExtension(DomainResource dr, String url, int value) {
Extension ex = getExtension(dr, url);
if (ex != null)
ex.setValue(new IntegerType(value));
else
dr.getExtension().add(Factory.newExtension(url, new IntegerType(value), true));
}
public static void addComment(Element nc, String comment) {
if (!StringUtils.isBlank(comment))
nc.getExtension().add(Factory.newExtension(EXT_COMMENT, Factory.newString_(comment), true));
}
// public static void markDeprecated(Element nc) {
// setDeprecated(nc);
// }
//
public static void addSubsumes(ConceptDefinitionComponent nc, String code) {
nc.getModifierExtension().add(Factory.newExtension(EXT_SUBSUMES, Factory.newCode(code), true));
}
public static void addDefinition(Element nc, String definition) {
if (!StringUtils.isBlank(definition))
nc.getExtension().add(Factory.newExtension(EXT_DEFINITION, Factory.newString_(definition), true));
}
public static void addDisplayHint(Element def, String hint) {
if (!StringUtils.isBlank(hint))
def.getExtension().add(Factory.newExtension(EXT_DISPLAY_HINT, Factory.newString_(hint), true));
}
public static String getDisplayHint(Element def) {
return readStringExtension(def, EXT_DISPLAY_HINT);
}
public static String readStringExtension(Element c, String uri) {
Extension ex = ExtensionHelper.getExtension(c, uri);
if (ex == null)
return null;
if (ex.getValue() instanceof UriType)
return ((UriType) ex.getValue()).getValue();
if (!(ex.getValue() instanceof StringType))
return null;
return ((StringType) ex.getValue()).getValue();
}
public static String readStringExtension(DomainResource c, String uri) {
Extension ex = getExtension(c, uri);
if (ex == null)
return null;
if ((ex.getValue() instanceof StringType))
return ((StringType) ex.getValue()).getValue();
if ((ex.getValue() instanceof UriType))
return ((UriType) ex.getValue()).getValue();
if ((ex.getValue() instanceof MarkdownType))
return ((MarkdownType) ex.getValue()).getValue();
return null;
}
@SuppressWarnings("unchecked")
public static PrimitiveType<Type> readPrimitiveExtension(DomainResource c, String uri) {
Extension ex = getExtension(c, uri);
if (ex == null)
return null;
return (PrimitiveType<Type>) ex.getValue();
}
public static boolean findStringExtension(Element c, String uri) {
Extension ex = ExtensionHelper.getExtension(c, uri);
if (ex == null)
return false;
if (!(ex.getValue() instanceof StringType))
return false;
return !StringUtils.isBlank(((StringType) ex.getValue()).getValue());
}
public static Boolean readBooleanExtension(Element c, String uri) {
Extension ex = ExtensionHelper.getExtension(c, uri);
if (ex == null)
return null;
if (!(ex.getValue() instanceof BooleanType))
return null;
return ((BooleanType) ex.getValue()).getValue();
}
public static boolean findBooleanExtension(Element c, String uri) {
Extension ex = ExtensionHelper.getExtension(c, uri);
if (ex == null)
return false;
if (!(ex.getValue() instanceof BooleanType))
return false;
return true;
}
public static String getComment(ConceptDefinitionComponent c) {
return readStringExtension(c, EXT_COMMENT);
}
//
// public static Boolean getDeprecated(Element c) {
// return readBooleanExtension(c, EXT_DEPRECATED);
// }
public static boolean hasComment(ConceptDefinitionComponent c) {
return findStringExtension(c, EXT_COMMENT);
}
// public static boolean hasDeprecated(Element c) {
// return findBooleanExtension(c, EXT_DEPRECATED);
// }
public static List<CodeType> getSubsumes(ConceptDefinitionComponent c) {
List<CodeType> res = new ArrayList<CodeType>();
for (Extension e : c.getExtension()) {
if (EXT_SUBSUMES.equals(e.getUrl()))
res.add((CodeType) e.getValue());
}
return res;
}
public static void addFlyOver(QuestionnaireItemComponent item, String text){
if (!StringUtils.isBlank(text)) {
QuestionnaireItemComponent display = item.addItem();
display.setType(QuestionnaireItemType.DISPLAY);
display.setText(text);
display.getExtension().add(Factory.newExtension(EXT_CONTROL, Factory.newCodeableConcept("flyover", "http://hl7.org/fhir/questionnaire-item-control", "Fly-over"), true));
}
}
public static void addMin(QuestionnaireItemComponent item, int min) {
item.getExtension().add(Factory.newExtension(EXT_MINOCCURS, Factory.newInteger(min), true));
}
public static void addMax(QuestionnaireItemComponent item, int max) {
item.getExtension().add(Factory.newExtension(EXT_MAXOCCURS, Factory.newInteger(max), true));
}
public static void addFhirType(QuestionnaireItemComponent group, String value) {
group.getExtension().add(Factory.newExtension(EXT_FHIRTYPE, Factory.newString_(value), true));
}
public static void addControl(QuestionnaireItemComponent group, String value) {
group.getExtension().add(Factory.newExtension(EXT_CONTROL, Factory.newCodeableConcept(value, "http://hl7.org/fhir/questionnaire-item-control", value), true));
}
public static void addAllowedResource(QuestionnaireItemComponent group, String value) {
group.getExtension().add(Factory.newExtension(EXT_ALLOWEDRESOURCE, Factory.newCode(value), true));
}
public static void addReferenceFilter(QuestionnaireItemComponent group, String value) {
group.getExtension().add(Factory.newExtension(EXT_REFERENCEFILTER, Factory.newString_(value), true));
}
public static void addIdentifier(Element element, Identifier value) {
element.getExtension().add(Factory.newExtension(EXT_IDENTIFIER, value, true));
}
/**
* @param name the identity of the extension of interest
* @return The extension, if on this element, else null
*/
public static Extension getExtension(DomainResource resource, String name) {
if (name == null)
return null;
if (!resource.hasExtension())
return null;
for (Extension e : resource.getExtension()) {
if (name.equals(e.getUrl()))
return e;
}
return null;
}
public static Extension getExtension(Element el, String name) {
if (name == null)
return null;
if (!el.hasExtension())
return null;
for (Extension e : el.getExtension()) {
if (name.equals(e.getUrl()))
return e;
}
return null;
}
public static void setStringExtension(DomainResource resource, String uri, String value) {
Extension ext = getExtension(resource, uri);
if (ext != null)
ext.setValue(new StringType(value));
else
resource.getExtension().add(new Extension(new UriType(uri)).setValue(new StringType(value)));
}
public static String getOID(CodeSystem define) {
return readStringExtension(define, EXT_OID);
}
public static String getOID(ValueSet vs) {
return readStringExtension(vs, EXT_OID);
}
public static void setOID(CodeSystem define, String oid) throws FHIRFormatError, URISyntaxException {
if (!oid.startsWith("urn:oid:"))
throw new FHIRFormatError("Error in OID format");
if (oid.startsWith("urn:oid:urn:oid:"))
throw new FHIRFormatError("Error in OID format");
if (!hasExtension(define, EXT_OID))
define.getExtension().add(Factory.newExtension(EXT_OID, Factory.newUri(oid), false));
else if (!oid.equals(readStringExtension(define, EXT_OID)))
throw new Error("Attempt to assign multiple OIDs to a code system");
}
public static void setOID(ValueSet vs, String oid) throws FHIRFormatError, URISyntaxException {
if (!oid.startsWith("urn:oid:"))
throw new FHIRFormatError("Error in OID format");
if (oid.startsWith("urn:oid:urn:oid:"))
throw new FHIRFormatError("Error in OID format");
if (!hasExtension(vs, EXT_OID))
vs.getExtension().add(Factory.newExtension(EXT_OID, Factory.newUri(oid), false));
else if (!oid.equals(readStringExtension(vs, EXT_OID)))
throw new Error("Attempt to assign multiple OIDs to value set "+vs.getName()+" ("+vs.getUrl()+"). Has "+readStringExtension(vs, EXT_OID)+", trying to add "+oid);
}
public static boolean hasLanguageTranslation(Element element, String lang) {
for (Extension e : element.getExtension()) {
if (e.getUrl().equals(EXT_TRANSLATION)) {
Extension e1 = ExtensionHelper.getExtension(e, "lang");
if (e1 != null && e1.getValue() instanceof CodeType && ((CodeType) e.getValue()).getValue().equals(lang))
return true;
}
}
return false;
}
public static String getLanguageTranslation(Element element, String lang) {
for (Extension e : element.getExtension()) {
if (e.getUrl().equals(EXT_TRANSLATION)) {
Extension e1 = ExtensionHelper.getExtension(e, "lang");
if (e1 != null && e1.getValue() instanceof CodeType && ((CodeType) e.getValue()).getValue().equals(lang)) {
e1 = ExtensionHelper.getExtension(e, "content");
return ((StringType) e.getValue()).getValue();
}
}
}
return null;
}
public static void addLanguageTranslation(Element element, String lang, String value) {
Extension extension = new Extension().setUrl(EXT_TRANSLATION);
extension.addExtension().setUrl("lang").setValue(new StringType(lang));
extension.addExtension().setUrl("content").setValue(new StringType(value));
element.getExtension().add(extension);
}
public static Type getAllowedUnits(ElementDefinition eld) {
for (Extension e : eld.getExtension())
if (e.getUrl().equals(EXT_ALLOWABLE_UNITS))
return e.getValue();
return null;
}
public static void setAllowableUnits(ElementDefinition eld, CodeableConcept cc) {
for (Extension e : eld.getExtension())
if (e.getUrl().equals(EXT_ALLOWABLE_UNITS)) {
e.setValue(cc);
return;
}
eld.getExtension().add(new Extension().setUrl(EXT_ALLOWABLE_UNITS).setValue(cc));
}
public static List<Extension> getExtensions(Element element, String url) {
List<Extension> results = new ArrayList<Extension>();
for (Extension ex : element.getExtension())
if (ex.getUrl().equals(url))
results.add(ex);
return results;
}
public static List<Extension> getExtensions(DomainResource resource, String url) {
List<Extension> results = new ArrayList<Extension>();
for (Extension ex : resource.getExtension())
if (ex.getUrl().equals(url))
results.add(ex);
return results;
}
public static void addDEReference(DataElement de, String value) {
for (Extension e : de.getExtension())
if (e.getUrl().equals(EXT_CIMI_REFERENCE)) {
e.setValue(new UriType(value));
return;
}
de.getExtension().add(new Extension().setUrl(EXT_CIMI_REFERENCE).setValue(new UriType(value)));
}
// public static void setDeprecated(Element nc) {
// for (Extension e : nc.getExtension())
// if (e.getUrl().equals(EXT_DEPRECATED)) {
// e.setValue(new BooleanType(true));
// return;
// }
// nc.getExtension().add(new Extension().setUrl(EXT_DEPRECATED).setValue(new BooleanType(true)));
// }
public static void setExtension(Element focus, String url, Coding c) {
for (Extension e : focus.getExtension())
if (e.getUrl().equals(url)) {
e.setValue(c);
return;
}
focus.getExtension().add(new Extension().setUrl(url).setValue(c));
}
public static void removeExtension(DomainResource focus, String url) {
Iterator<Extension> i = focus.getExtension().iterator();
while (i.hasNext()) {
Extension e = i.next(); // must be called before you can call i.remove()
if (e.getUrl().equals(url)) {
i.remove();
}
}
}
public static void removeExtension(Element focus, String url) {
Iterator<Extension> i = focus.getExtension().iterator();
while (i.hasNext()) {
Extension e = i.next(); // must be called before you can call i.remove()
if (e.getUrl().equals(url)) {
i.remove();
}
}
}
public static boolean hasOID(ValueSet vs) {
return hasExtension(vs, EXT_OID);
}
}
package org.hl7.fhir.dstu2016may.utils;
import java.net.URISyntaxException;
/*
Copyright (c) 2011+, HL7, Inc
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of HL7 nor the names of its contributors may be used to
endorse or promote products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.apache.commons.lang3.StringUtils;
import org.hl7.fhir.dstu2016may.model.BooleanType;
import org.hl7.fhir.dstu2016may.model.CodeSystem;
import org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionComponent;
import org.hl7.fhir.dstu2016may.model.CodeType;
import org.hl7.fhir.dstu2016may.model.CodeableConcept;
import org.hl7.fhir.dstu2016may.model.Coding;
import org.hl7.fhir.dstu2016may.model.DataElement;
import org.hl7.fhir.dstu2016may.model.DomainResource;
import org.hl7.fhir.dstu2016may.model.Element;
import org.hl7.fhir.dstu2016may.model.ElementDefinition;
import org.hl7.fhir.dstu2016may.model.Extension;
import org.hl7.fhir.dstu2016may.model.ExtensionHelper;
import org.hl7.fhir.dstu2016may.model.Factory;
import org.hl7.fhir.dstu2016may.model.Identifier;
import org.hl7.fhir.dstu2016may.model.IntegerType;
import org.hl7.fhir.dstu2016may.model.MarkdownType;
import org.hl7.fhir.dstu2016may.model.PrimitiveType;
import org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemComponent;
import org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType;
import org.hl7.fhir.dstu2016may.model.StringType;
import org.hl7.fhir.dstu2016may.model.Type;
import org.hl7.fhir.dstu2016may.model.UriType;
import org.hl7.fhir.dstu2016may.model.ValueSet;
import org.hl7.fhir.utilities.validation.ValidationMessage.Source;
import org.hl7.fhir.exceptions.FHIRFormatError;
public class ToolingExtensions {
// validated
public static final String EXT_SUBSUMES = "http://hl7.org/fhir/StructureDefinition/codesystem-subsumes";
private static final String EXT_OID = "http://hl7.org/fhir/StructureDefinition/valueset-oid";
// public static final String EXT_DEPRECATED = "http://hl7.org/fhir/StructureDefinition/codesystem-deprecated";
public static final String EXT_DEFINITION = "http://hl7.org/fhir/StructureDefinition/valueset-definition";
public static final String EXT_COMMENT = "http://hl7.org/fhir/StructureDefinition/valueset-comments";
private static final String EXT_IDENTIFIER = "http://hl7.org/fhir/StructureDefinition/identifier";
private static final String EXT_TRANSLATION = "http://hl7.org/fhir/StructureDefinition/translation";
public static final String EXT_ISSUE_SOURCE = "http://hl7.org/fhir/StructureDefinition/operationoutcome-issue-source";
public static final String EXT_DISPLAY_HINT = "http://hl7.org/fhir/StructureDefinition/structuredefinition-display-hint";
public static final String EXT_REPLACED_BY = "http://hl7.org/fhir/StructureDefinition/valueset-replacedby";
public static final String EXT_JSON_TYPE = "http://hl7.org/fhir/StructureDefinition/structuredefinition-json-type";
public static final String EXT_XML_TYPE = "http://hl7.org/fhir/StructureDefinition/structuredefinition-xml-type";
public static final String EXT_REGEX = "http://hl7.org/fhir/StructureDefinition/structuredefinition-regex";
public static final String EXT_CONTROL = "http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl";
public static final String EXT_MINOCCURS = "http://hl7.org/fhir/StructureDefinition/questionnaire-minOccurs";
public static final String EXT_MAXOCCURS = "http://hl7.org/fhir/StructureDefinition/questionnaire-maxOccurs";
public static final String EXT_ALLOWEDRESOURCE = "http://hl7.org/fhir/StructureDefinition/questionnaire-allowedResource";
public static final String EXT_REFERENCEFILTER = "http://hl7.org/fhir/StructureDefinition/questionnaire-referenceFilter";
// unregistered?
// public static final String EXT_FLYOVER = "http://hl7.org/fhir/Profile/questionnaire-extensions#flyover";
// private static final String EXT_QTYPE = "http://www.healthintersections.com.au/fhir/Profile/metadata#type";
// private static final String EXT_QREF = "http://www.healthintersections.com.au/fhir/Profile/metadata#reference";
// private static final String EXTENSION_FILTER_ONLY = "http://www.healthintersections.com.au/fhir/Profile/metadata#expandNeedsFilter";
// private static final String EXT_TYPE = "http://www.healthintersections.com.au/fhir/Profile/metadata#type";
// private static final String EXT_REFERENCE = "http://www.healthintersections.com.au/fhir/Profile/metadata#reference";
private static final String EXT_FHIRTYPE = "http://hl7.org/fhir/StructureDefinition/questionnaire-fhirType";
private static final String EXT_ALLOWABLE_UNITS = "http://hl7.org/fhir/StructureDefinition/elementdefinition-allowedUnits";
public static final String EXT_CIMI_REFERENCE = "http://hl7.org/fhir/StructureDefinition/cimi-reference";
public static final String EXT_UNCLOSED = "http://hl7.org/fhir/StructureDefinition/valueset-unclosed";
public static final String EXT_FMM_LEVEL = "http://hl7.org/fhir/StructureDefinition/structuredefinition-fmm";
// specific extension helpers
public static Extension makeIssueSource(Source source) {
Extension ex = new Extension();
// todo: write this up and get it published with the pack (and handle the redirect?)
ex.setUrl(ToolingExtensions.EXT_ISSUE_SOURCE);
CodeType c = new CodeType();
c.setValue(source.toString());
ex.setValue(c);
return ex;
}
public static boolean hasExtension(DomainResource de, String url) {
return getExtension(de, url) != null;
}
public static boolean hasExtension(Element e, String url) {
return getExtension(e, url) != null;
}
public static void addStringExtension(DomainResource dr, String url, String content) {
if (!StringUtils.isBlank(content)) {
Extension ex = getExtension(dr, url);
if (ex != null)
ex.setValue(new StringType(content));
else
dr.getExtension().add(Factory.newExtension(url, new StringType(content), true));
}
}
public static void addMarkdownExtension(DomainResource dr, String url, String content) {
if (!StringUtils.isBlank(content)) {
Extension ex = getExtension(dr, url);
if (ex != null)
ex.setValue(new StringType(content));
else
dr.getExtension().add(Factory.newExtension(url, new MarkdownType(content), true));
}
}
public static void addStringExtension(Element e, String url, String content) {
if (!StringUtils.isBlank(content)) {
Extension ex = getExtension(e, url);
if (ex != null)
ex.setValue(new StringType(content));
else
e.getExtension().add(Factory.newExtension(url, new StringType(content), true));
}
}
public static void addIntegerExtension(DomainResource dr, String url, int value) {
Extension ex = getExtension(dr, url);
if (ex != null)
ex.setValue(new IntegerType(value));
else
dr.getExtension().add(Factory.newExtension(url, new IntegerType(value), true));
}
public static void addComment(Element nc, String comment) {
if (!StringUtils.isBlank(comment))
nc.getExtension().add(Factory.newExtension(EXT_COMMENT, Factory.newString_(comment), true));
}
// public static void markDeprecated(Element nc) {
// setDeprecated(nc);
// }
//
public static void addSubsumes(ConceptDefinitionComponent nc, String code) {
nc.getModifierExtension().add(Factory.newExtension(EXT_SUBSUMES, Factory.newCode(code), true));
}
public static void addDefinition(Element nc, String definition) {
if (!StringUtils.isBlank(definition))
nc.getExtension().add(Factory.newExtension(EXT_DEFINITION, Factory.newString_(definition), true));
}
public static void addDisplayHint(Element def, String hint) {
if (!StringUtils.isBlank(hint))
def.getExtension().add(Factory.newExtension(EXT_DISPLAY_HINT, Factory.newString_(hint), true));
}
public static String getDisplayHint(Element def) {
return readStringExtension(def, EXT_DISPLAY_HINT);
}
public static String readStringExtension(Element c, String uri) {
Extension ex = ExtensionHelper.getExtension(c, uri);
if (ex == null)
return null;
if (ex.getValue() instanceof UriType)
return ((UriType) ex.getValue()).getValue();
if (!(ex.getValue() instanceof StringType))
return null;
return ((StringType) ex.getValue()).getValue();
}
public static String readStringExtension(DomainResource c, String uri) {
Extension ex = getExtension(c, uri);
if (ex == null)
return null;
if ((ex.getValue() instanceof StringType))
return ((StringType) ex.getValue()).getValue();
if ((ex.getValue() instanceof UriType))
return ((UriType) ex.getValue()).getValue();
if ((ex.getValue() instanceof MarkdownType))
return ((MarkdownType) ex.getValue()).getValue();
return null;
}
@SuppressWarnings("unchecked")
public static PrimitiveType<Type> readPrimitiveExtension(DomainResource c, String uri) {
Extension ex = getExtension(c, uri);
if (ex == null)
return null;
return (PrimitiveType<Type>) ex.getValue();
}
public static boolean findStringExtension(Element c, String uri) {
Extension ex = ExtensionHelper.getExtension(c, uri);
if (ex == null)
return false;
if (!(ex.getValue() instanceof StringType))
return false;
return !StringUtils.isBlank(((StringType) ex.getValue()).getValue());
}
public static Boolean readBooleanExtension(Element c, String uri) {
Extension ex = ExtensionHelper.getExtension(c, uri);
if (ex == null)
return null;
if (!(ex.getValue() instanceof BooleanType))
return null;
return ((BooleanType) ex.getValue()).getValue();
}
public static boolean findBooleanExtension(Element c, String uri) {
Extension ex = ExtensionHelper.getExtension(c, uri);
if (ex == null)
return false;
if (!(ex.getValue() instanceof BooleanType))
return false;
return true;
}
public static String getComment(ConceptDefinitionComponent c) {
return readStringExtension(c, EXT_COMMENT);
}
//
// public static Boolean getDeprecated(Element c) {
// return readBooleanExtension(c, EXT_DEPRECATED);
// }
public static boolean hasComment(ConceptDefinitionComponent c) {
return findStringExtension(c, EXT_COMMENT);
}
// public static boolean hasDeprecated(Element c) {
// return findBooleanExtension(c, EXT_DEPRECATED);
// }
public static List<CodeType> getSubsumes(ConceptDefinitionComponent c) {
List<CodeType> res = new ArrayList<CodeType>();
for (Extension e : c.getExtension()) {
if (EXT_SUBSUMES.equals(e.getUrl()))
res.add((CodeType) e.getValue());
}
return res;
}
public static void addFlyOver(QuestionnaireItemComponent item, String text){
if (!StringUtils.isBlank(text)) {
QuestionnaireItemComponent display = item.addItem();
display.setType(QuestionnaireItemType.DISPLAY);
display.setText(text);
display.getExtension().add(Factory.newExtension(EXT_CONTROL, Factory.newCodeableConcept("flyover", "http://hl7.org/fhir/questionnaire-item-control", "Fly-over"), true));
}
}
public static void addMin(QuestionnaireItemComponent item, int min) {
item.getExtension().add(Factory.newExtension(EXT_MINOCCURS, Factory.newInteger(min), true));
}
public static void addMax(QuestionnaireItemComponent item, int max) {
item.getExtension().add(Factory.newExtension(EXT_MAXOCCURS, Factory.newInteger(max), true));
}
public static void addFhirType(QuestionnaireItemComponent group, String value) {
group.getExtension().add(Factory.newExtension(EXT_FHIRTYPE, Factory.newString_(value), true));
}
public static void addControl(QuestionnaireItemComponent group, String value) {
group.getExtension().add(Factory.newExtension(EXT_CONTROL, Factory.newCodeableConcept(value, "http://hl7.org/fhir/questionnaire-item-control", value), true));
}
public static void addAllowedResource(QuestionnaireItemComponent group, String value) {
group.getExtension().add(Factory.newExtension(EXT_ALLOWEDRESOURCE, Factory.newCode(value), true));
}
public static void addReferenceFilter(QuestionnaireItemComponent group, String value) {
group.getExtension().add(Factory.newExtension(EXT_REFERENCEFILTER, Factory.newString_(value), true));
}
public static void addIdentifier(Element element, Identifier value) {
element.getExtension().add(Factory.newExtension(EXT_IDENTIFIER, value, true));
}
/**
* @param name the identity of the extension of interest
* @return The extension, if on this element, else null
*/
public static Extension getExtension(DomainResource resource, String name) {
if (name == null)
return null;
if (!resource.hasExtension())
return null;
for (Extension e : resource.getExtension()) {
if (name.equals(e.getUrl()))
return e;
}
return null;
}
public static Extension getExtension(Element el, String name) {
if (name == null)
return null;
if (!el.hasExtension())
return null;
for (Extension e : el.getExtension()) {
if (name.equals(e.getUrl()))
return e;
}
return null;
}
public static void setStringExtension(DomainResource resource, String uri, String value) {
Extension ext = getExtension(resource, uri);
if (ext != null)
ext.setValue(new StringType(value));
else
resource.getExtension().add(new Extension(new UriType(uri)).setValue(new StringType(value)));
}
public static String getOID(CodeSystem define) {
return readStringExtension(define, EXT_OID);
}
public static String getOID(ValueSet vs) {
return readStringExtension(vs, EXT_OID);
}
public static void setOID(CodeSystem define, String oid) throws FHIRFormatError, URISyntaxException {
if (!oid.startsWith("urn:oid:"))
throw new FHIRFormatError("Error in OID format");
if (oid.startsWith("urn:oid:urn:oid:"))
throw new FHIRFormatError("Error in OID format");
if (!hasExtension(define, EXT_OID))
define.getExtension().add(Factory.newExtension(EXT_OID, Factory.newUri(oid), false));
else if (!oid.equals(readStringExtension(define, EXT_OID)))
throw new Error("Attempt to assign multiple OIDs to a code system");
}
public static void setOID(ValueSet vs, String oid) throws FHIRFormatError, URISyntaxException {
if (!oid.startsWith("urn:oid:"))
throw new FHIRFormatError("Error in OID format");
if (oid.startsWith("urn:oid:urn:oid:"))
throw new FHIRFormatError("Error in OID format");
if (!hasExtension(vs, EXT_OID))
vs.getExtension().add(Factory.newExtension(EXT_OID, Factory.newUri(oid), false));
else if (!oid.equals(readStringExtension(vs, EXT_OID)))
throw new Error("Attempt to assign multiple OIDs to value set "+vs.getName()+" ("+vs.getUrl()+"). Has "+readStringExtension(vs, EXT_OID)+", trying to add "+oid);
}
public static boolean hasLanguageTranslation(Element element, String lang) {
for (Extension e : element.getExtension()) {
if (e.getUrl().equals(EXT_TRANSLATION)) {
Extension e1 = ExtensionHelper.getExtension(e, "lang");
if (e1 != null && e1.getValue() instanceof CodeType && ((CodeType) e.getValue()).getValue().equals(lang))
return true;
}
}
return false;
}
public static String getLanguageTranslation(Element element, String lang) {
for (Extension e : element.getExtension()) {
if (e.getUrl().equals(EXT_TRANSLATION)) {
Extension e1 = ExtensionHelper.getExtension(e, "lang");
if (e1 != null && e1.getValue() instanceof CodeType && ((CodeType) e.getValue()).getValue().equals(lang)) {
e1 = ExtensionHelper.getExtension(e, "content");
return ((StringType) e.getValue()).getValue();
}
}
}
return null;
}
public static void addLanguageTranslation(Element element, String lang, String value) {
Extension extension = new Extension().setUrl(EXT_TRANSLATION);
extension.addExtension().setUrl("lang").setValue(new StringType(lang));
extension.addExtension().setUrl("content").setValue(new StringType(value));
element.getExtension().add(extension);
}
public static Type getAllowedUnits(ElementDefinition eld) {
for (Extension e : eld.getExtension())
if (e.getUrl().equals(EXT_ALLOWABLE_UNITS))
return e.getValue();
return null;
}
public static void setAllowableUnits(ElementDefinition eld, CodeableConcept cc) {
for (Extension e : eld.getExtension())
if (e.getUrl().equals(EXT_ALLOWABLE_UNITS)) {
e.setValue(cc);
return;
}
eld.getExtension().add(new Extension().setUrl(EXT_ALLOWABLE_UNITS).setValue(cc));
}
public static List<Extension> getExtensions(Element element, String url) {
List<Extension> results = new ArrayList<Extension>();
for (Extension ex : element.getExtension())
if (ex.getUrl().equals(url))
results.add(ex);
return results;
}
public static List<Extension> getExtensions(DomainResource resource, String url) {
List<Extension> results = new ArrayList<Extension>();
for (Extension ex : resource.getExtension())
if (ex.getUrl().equals(url))
results.add(ex);
return results;
}
public static void addDEReference(DataElement de, String value) {
for (Extension e : de.getExtension())
if (e.getUrl().equals(EXT_CIMI_REFERENCE)) {
e.setValue(new UriType(value));
return;
}
de.getExtension().add(new Extension().setUrl(EXT_CIMI_REFERENCE).setValue(new UriType(value)));
}
// public static void setDeprecated(Element nc) {
// for (Extension e : nc.getExtension())
// if (e.getUrl().equals(EXT_DEPRECATED)) {
// e.setValue(new BooleanType(true));
// return;
// }
// nc.getExtension().add(new Extension().setUrl(EXT_DEPRECATED).setValue(new BooleanType(true)));
// }
public static void setExtension(Element focus, String url, Coding c) {
for (Extension e : focus.getExtension())
if (e.getUrl().equals(url)) {
e.setValue(c);
return;
}
focus.getExtension().add(new Extension().setUrl(url).setValue(c));
}
public static void removeExtension(DomainResource focus, String url) {
Iterator<Extension> i = focus.getExtension().iterator();
while (i.hasNext()) {
Extension e = i.next(); // must be called before you can call i.remove()
if (e.getUrl().equals(url)) {
i.remove();
}
}
}
public static void removeExtension(Element focus, String url) {
Iterator<Extension> i = focus.getExtension().iterator();
while (i.hasNext()) {
Extension e = i.next(); // must be called before you can call i.remove()
if (e.getUrl().equals(url)) {
i.remove();
}
}
}
public static boolean hasOID(ValueSet vs) {
return hasExtension(vs, EXT_OID);
}
public static void setStringExtension(Element element, String uri, String value) {
Extension ext = getExtension(element, uri);
if (ext != null)
ext.setValue(new StringType(value));
else
element.getExtension().add(new Extension(new UriType(uri)).setValue(new StringType(value)));
}
}

View File

@ -0,0 +1,174 @@
package org.hl7.fhir.dstu3.utils;
import java.io.IOException;
import java.io.InputStream;
import java.util.List;
import org.hl7.fhir.dstu3.elementmodel.Element;
import org.hl7.fhir.dstu3.elementmodel.Manager.FhirFormat;
import org.hl7.fhir.dstu3.model.StructureDefinition;
import org.hl7.fhir.dstu3.utils.IResourceValidator.ReferenceValidationPolicy;
import org.hl7.fhir.exceptions.DefinitionException;
import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.exceptions.FHIRFormatError;
import org.hl7.fhir.utilities.validation.ValidationMessage;
import com.google.gson.JsonObject;
/**
* Interface to the instance validator. This takes a resource, in one of many forms, and
* checks whether it is valid
*
* @author Grahame Grieve
*
*/
public interface IResourceValidator {
public enum ReferenceValidationPolicy {
IGNORE, CHECK_TYPE_IF_EXISTS, CHECK_EXISTS, CHECK_EXISTS_AND_TYPE, CHECK_VALID;
public boolean checkExists() {
return this == CHECK_EXISTS_AND_TYPE || this == CHECK_EXISTS || this == CHECK_VALID;
}
public boolean checkType() {
return this == CHECK_TYPE_IF_EXISTS || this == CHECK_EXISTS_AND_TYPE || this == CHECK_VALID;
}
public boolean checkValid() {
return this == CHECK_VALID;
}
}
public interface IValidatorResourceFetcher {
Element fetch(Object appContext, String url) throws FHIRFormatError, DefinitionException, IOException, FHIRException;
ReferenceValidationPolicy validationPolicy(Object appContext, String path, String url);
boolean resolveURL(Object appContext, String path, String url) throws IOException, FHIRException;
}
public enum BestPracticeWarningLevel {
Ignore,
Hint,
Warning,
Error
}
public enum CheckDisplayOption {
Ignore,
Check,
CheckCaseAndSpace,
CheckCase,
CheckSpace
}
enum IdStatus {
OPTIONAL, REQUIRED, PROHIBITED
}
/**
* how much to check displays for coded elements
* @return
*/
CheckDisplayOption getCheckDisplay();
void setCheckDisplay(CheckDisplayOption checkDisplay);
/**
* whether the resource must have an id or not (depends on context)
*
* @return
*/
IdStatus getResourceIdRule();
void setResourceIdRule(IdStatus resourceIdRule);
/**
* whether the validator should enforce best practice guidelines
* as defined by various HL7 committees
*
*/
BestPracticeWarningLevel getBasePracticeWarningLevel();
IResourceValidator setBestPracticeWarningLevel(BestPracticeWarningLevel value);
IValidatorResourceFetcher getFetcher();
IResourceValidator setFetcher(IValidatorResourceFetcher value);
boolean isNoBindingMsgSuppressed();
IResourceValidator setNoBindingMsgSuppressed(boolean noBindingMsgSuppressed);
public boolean isNoInvariantChecks();
public IResourceValidator setNoInvariantChecks(boolean value) ;
public boolean isNoTerminologyChecks();
public IResourceValidator setNoTerminologyChecks(boolean noTerminologyChecks);
/**
* Whether being unable to resolve a profile in found in Resource.meta.profile or ElementDefinition.type.profile or targetProfile is an error or just a warning
* @return
*/
public boolean isErrorForUnknownProfiles();
public void setErrorForUnknownProfiles(boolean errorForUnknownProfiles);
/**
* Validate suite
*
* you can validate one of the following representations of resources:
*
* stream - provide a format - this is the preferred choice
*
* Use one of these two if the content is known to be valid XML/JSON, and already parsed
* - a DOM element or Document
* - a Json Object
*
* In order to use these, the content must already be parsed - e.g. it must syntactically valid
* - a native resource
* - a elementmodel resource
*
* in addition, you can pass one or more profiles ti validate beyond the base standard - as structure definitions or canonical URLs
* @throws IOException
*/
void validate(Object Context, List<ValidationMessage> errors, org.hl7.fhir.dstu3.elementmodel.Element element) throws FHIRException, IOException;
void validate(Object Context, List<ValidationMessage> errors, org.hl7.fhir.dstu3.elementmodel.Element element, ValidationProfileSet profiles) throws FHIRException, IOException;
@Deprecated
void validate(Object Context, List<ValidationMessage> errors, org.hl7.fhir.dstu3.elementmodel.Element element, String profile) throws FHIRException, IOException;
@Deprecated
void validate(Object Context, List<ValidationMessage> errors, org.hl7.fhir.dstu3.elementmodel.Element element, StructureDefinition profile) throws FHIRException, IOException;
org.hl7.fhir.dstu3.elementmodel.Element validate(Object Context, List<ValidationMessage> errors, InputStream stream, FhirFormat format) throws FHIRException, IOException;
org.hl7.fhir.dstu3.elementmodel.Element validate(Object Context, List<ValidationMessage> errors, InputStream stream, FhirFormat format, ValidationProfileSet profiles) throws FHIRException, IOException;
@Deprecated
org.hl7.fhir.dstu3.elementmodel.Element validate(Object Context, List<ValidationMessage> errors, InputStream stream, FhirFormat format, String profile) throws FHIRException, IOException;
@Deprecated
org.hl7.fhir.dstu3.elementmodel.Element validate(Object Context, List<ValidationMessage> errors, InputStream stream, FhirFormat format, StructureDefinition profile) throws FHIRException, IOException;
org.hl7.fhir.dstu3.elementmodel.Element validate(Object Context, List<ValidationMessage> errors, org.hl7.fhir.dstu3.model.Resource resource) throws FHIRException, IOException;
org.hl7.fhir.dstu3.elementmodel.Element validate(Object Context, List<ValidationMessage> errors, org.hl7.fhir.dstu3.model.Resource resource, ValidationProfileSet profiles) throws FHIRException, IOException;
@Deprecated
org.hl7.fhir.dstu3.elementmodel.Element validate(Object Context, List<ValidationMessage> errors, org.hl7.fhir.dstu3.model.Resource resource, String profile) throws FHIRException, IOException;
@Deprecated
org.hl7.fhir.dstu3.elementmodel.Element validate(Object Context, List<ValidationMessage> errors, org.hl7.fhir.dstu3.model.Resource resource, StructureDefinition profile) throws FHIRException, IOException;
org.hl7.fhir.dstu3.elementmodel.Element validate(Object Context, List<ValidationMessage> errors, org.w3c.dom.Element element) throws FHIRException, IOException;
org.hl7.fhir.dstu3.elementmodel.Element validate(Object Context, List<ValidationMessage> errors, org.w3c.dom.Element element, ValidationProfileSet profiles) throws FHIRException, IOException;
@Deprecated
org.hl7.fhir.dstu3.elementmodel.Element validate(Object Context, List<ValidationMessage> errors, org.w3c.dom.Element element, String profile) throws FHIRException, IOException;
@Deprecated
org.hl7.fhir.dstu3.elementmodel.Element validate(Object Context, List<ValidationMessage> errors, org.w3c.dom.Element element, StructureDefinition profile) throws FHIRException, IOException;
org.hl7.fhir.dstu3.elementmodel.Element validate(Object Context, List<ValidationMessage> errors, org.w3c.dom.Document document) throws FHIRException, IOException;
org.hl7.fhir.dstu3.elementmodel.Element validate(Object Context, List<ValidationMessage> errors, org.w3c.dom.Document document, ValidationProfileSet profiles) throws FHIRException, IOException;
@Deprecated
org.hl7.fhir.dstu3.elementmodel.Element validate(Object Context, List<ValidationMessage> errors, org.w3c.dom.Document document, String profile) throws FHIRException, IOException;
@Deprecated
org.hl7.fhir.dstu3.elementmodel.Element validate(Object Context, List<ValidationMessage> errors, org.w3c.dom.Document document, StructureDefinition profile) throws FHIRException, IOException;
org.hl7.fhir.dstu3.elementmodel.Element validate(Object Context, List<ValidationMessage> errors, JsonObject object) throws FHIRException, IOException;
org.hl7.fhir.dstu3.elementmodel.Element validate(Object Context, List<ValidationMessage> errors, JsonObject object, ValidationProfileSet profiles) throws FHIRException, IOException;
@Deprecated
org.hl7.fhir.dstu3.elementmodel.Element validate(Object Context, List<ValidationMessage> errors, JsonObject object, String profile) throws FHIRException, IOException;
@Deprecated
org.hl7.fhir.dstu3.elementmodel.Element validate(Object Context, List<ValidationMessage> errors, JsonObject object, StructureDefinition profile) throws FHIRException, IOException;
}

View File

@ -30,16 +30,38 @@ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
import java.util.*;
import org.hl7.fhir.exceptions.FHIRFormatError;
import org.hl7.fhir.instance.model.*;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.hl7.fhir.instance.model.BooleanType;
import org.hl7.fhir.instance.model.CodeType;
import org.hl7.fhir.instance.model.CodeableConcept;
import org.hl7.fhir.instance.model.Coding;
import org.hl7.fhir.instance.model.DataElement;
import org.hl7.fhir.instance.model.DomainResource;
import org.hl7.fhir.instance.model.Element;
import org.hl7.fhir.instance.model.ElementDefinition;
import org.hl7.fhir.instance.model.Extension;
import org.hl7.fhir.instance.model.ExtensionHelper;
import org.hl7.fhir.instance.model.Factory;
import org.hl7.fhir.instance.model.Identifier;
import org.hl7.fhir.instance.model.IntegerType;
import org.hl7.fhir.instance.model.MarkdownType;
import org.hl7.fhir.instance.model.PrimitiveType;
import org.hl7.fhir.instance.model.Questionnaire.GroupComponent;
import org.hl7.fhir.instance.model.Questionnaire.QuestionComponent;
import org.hl7.fhir.instance.model.Reference;
import org.hl7.fhir.instance.model.StringType;
import org.hl7.fhir.instance.model.Type;
import org.hl7.fhir.instance.model.UriType;
import org.hl7.fhir.instance.model.ValueSet;
import org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionComponent;
import org.hl7.fhir.instance.model.ValueSet.ValueSetCodeSystemComponent;
import org.hl7.fhir.utilities.validation.ValidationMessage.Source;
import org.hl7.fhir.exceptions.FHIRFormatError;
import org.hl7.fhir.utilities.Utilities;
import org.hl7.fhir.utilities.validation.ValidationMessage;
public class ToolingExtensions {
@ -77,12 +99,12 @@ public class ToolingExtensions {
// specific extension helpers
public static Extension makeIssueSource(ValidationMessage.Source theSource) {
public static Extension makeIssueSource(Source source) {
Extension ex = new Extension();
// todo: write this up and get it published with the pack (and handle the redirect?)
ex.setUrl(ToolingExtensions.EXT_ISSUE_SOURCE);
CodeType c = new CodeType();
c.setValue(theSource.toString());
c.setValue(source.toString());
ex.setValue(c);
return ex;
}
@ -441,4 +463,15 @@ public class ToolingExtensions {
}
}
}
public static void setStringExtension(Element element, String uri, String value) {
Extension ext = getExtension(element, uri);
if (ext != null)
ext.setValue(new StringType(value));
else
element.getExtension().add(new Extension(new UriType(uri)).setValue(new StringType(value)));
}
}

View File

@ -0,0 +1,50 @@
package org.hl7.fhir.r4.conformance;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.UnsupportedEncodingException;
import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.r4.context.IWorkerContext;
import org.hl7.fhir.r4.model.StructureDefinition;
import org.hl7.fhir.utilities.Utilities;
public class ConstraintJavaGenerator {
private IWorkerContext context; // for doing expansions
private String version; // for getting includes correct
private String folder; //dest dir where the profile will be generated into
private String packageName;
public ConstraintJavaGenerator(IWorkerContext context, String version, String folder, String packageName) {
super();
this.context = context;
this.version = version;
this.folder = folder;
this.packageName = packageName;
}
public String generate(StructureDefinition sd) throws FHIRException, IOException {
String name = sd.getName();
if (!Utilities.nmtokenize(name).equals(name))
throw new FHIRException("Cannot generate Java code for profile "+sd.getUrl()+" because the name \""+name+"\" is not a valid Java class name");
File destFile = new File(Utilities.path(folder, name+".java"));
OutputStreamWriter dest = new OutputStreamWriter(new FileOutputStream(destFile), "UTF-8");
dest.write("package "+packageName+";\r\n");
dest.write("\r\n");
dest.write("import org.hl7.fhir.r4.model.ProfilingWrapper;\r\n");
dest.write("\r\n");
dest.write("public class "+name+" {\r\n");
dest.write("\r\n");
dest.write("}\r\n");
dest.flush();
return destFile.getAbsolutePath();
}
}

View File

@ -35,6 +35,7 @@ import org.hl7.fhir.r4.terminologies.ValueSetExpander.ValueSetExpansionOutcome;
import org.hl7.fhir.r4.utils.DefinitionNavigator;
import org.hl7.fhir.r4.utils.ToolingExtensions;
import org.hl7.fhir.exceptions.DefinitionException;
import org.hl7.fhir.exceptions.FHIRFormatError;
import org.hl7.fhir.utilities.CommaSeparatedStringBuilder;
import org.hl7.fhir.utilities.Utilities;
import org.hl7.fhir.utilities.validation.ValidationMessage;
@ -256,10 +257,11 @@ public class ProfileComparer {
* over the right ones in the common structure definition
* @throws DefinitionException
* @throws IOException
* @throws FHIRFormatError
*
* @
*/
public ProfileComparison compareProfiles(StructureDefinition left, StructureDefinition right) throws DefinitionException, IOException {
public ProfileComparison compareProfiles(StructureDefinition left, StructureDefinition right) throws DefinitionException, IOException, FHIRFormatError {
ProfileComparison outcome = new ProfileComparison();
outcome.left = left;
outcome.right = right;
@ -324,8 +326,9 @@ public class ProfileComparer {
* @- if there's a problem that needs fixing in this code
* @throws DefinitionException
* @throws IOException
* @throws FHIRFormatError
*/
private boolean compareElements(ProfileComparison outcome, String path, DefinitionNavigator left, DefinitionNavigator right) throws DefinitionException, IOException {
private boolean compareElements(ProfileComparison outcome, String path, DefinitionNavigator left, DefinitionNavigator right) throws DefinitionException, IOException, FHIRFormatError {
// preconditions:
assert(path != null);
assert(left != null);
@ -433,7 +436,7 @@ public class ProfileComparer {
if (left.slices() != null)
for (DefinitionNavigator ex : left.slices()) {
String url = ex.current().getType().get(0).getProfile();
String url = ex.current().getType().get(0).getProfile().get(0).getValue();
if (map.containsKey(url))
throw new DefinitionException("Duplicate Extension "+url+" at "+path);
else
@ -441,7 +444,7 @@ public class ProfileComparer {
}
if (right.slices() != null)
for (DefinitionNavigator ex : right.slices()) {
String url = ex.current().getType().get(0).getProfile();
String url = ex.current().getType().get(0).getProfile().get(0).getValue();
if (map.containsKey(url)) {
ExtensionUsage exd = map.get(url);
exd.minSuperset = unionMin(exd.defn.current().getMin(), ex.current().getMin());
@ -470,7 +473,7 @@ public class ProfileComparer {
return path.endsWith(".extension") || path.endsWith(".modifierExtension");
}
private boolean compareChildren(ElementDefinition ed, ProfileComparison outcome, String path, DefinitionNavigator left, DefinitionNavigator right) throws DefinitionException, IOException {
private boolean compareChildren(ElementDefinition ed, ProfileComparison outcome, String path, DefinitionNavigator left, DefinitionNavigator right) throws DefinitionException, IOException, FHIRFormatError {
List<DefinitionNavigator> lc = left.children();
List<DefinitionNavigator> rc = right.children();
// it's possible that one of these profiles walks into a data type and the other doesn't
@ -513,7 +516,7 @@ public class ProfileComparer {
return null;
}
private boolean compareBindings(ProfileComparison outcome, ElementDefinition subset, ElementDefinition superset, String path, ElementDefinition lDef, ElementDefinition rDef) {
private boolean compareBindings(ProfileComparison outcome, ElementDefinition subset, ElementDefinition superset, String path, ElementDefinition lDef, ElementDefinition rDef) throws FHIRFormatError {
assert(lDef.hasBinding() || rDef.hasBinding());
if (!lDef.hasBinding()) {
subset.setBinding(rDef.getBinding());
@ -633,7 +636,7 @@ public class ProfileComparer {
return false;
}
private ElementDefinitionBindingComponent unionBindings(ElementDefinition ed, ProfileComparison outcome, String path, ElementDefinitionBindingComponent left, ElementDefinitionBindingComponent right) {
private ElementDefinitionBindingComponent unionBindings(ElementDefinition ed, ProfileComparison outcome, String path, ElementDefinitionBindingComponent left, ElementDefinitionBindingComponent right) throws FHIRFormatError {
ElementDefinitionBindingComponent union = new ElementDefinitionBindingComponent();
if (left.getStrength().compareTo(right.getStrength()) < 0)
union.setStrength(left.getStrength());
@ -771,7 +774,7 @@ public class ProfileComparer {
return binding.getStrength() == BindingStrength.EXAMPLE || binding.getStrength() == BindingStrength.PREFERRED;
}
private Collection<? extends TypeRefComponent> intersectTypes(ElementDefinition ed, ProfileComparison outcome, String path, List<TypeRefComponent> left, List<TypeRefComponent> right) throws DefinitionException, IOException {
private Collection<? extends TypeRefComponent> intersectTypes(ElementDefinition ed, ProfileComparison outcome, String path, List<TypeRefComponent> left, List<TypeRefComponent> right) throws DefinitionException, IOException, FHIRFormatError {
List<TypeRefComponent> result = new ArrayList<TypeRefComponent>();
for (TypeRefComponent l : left) {
if (l.hasAggregation())
@ -790,8 +793,8 @@ public class ProfileComparer {
pfound = true;
c.setProfile(r.getProfile());
} else {
StructureDefinition sdl = resolveProfile(ed, outcome, path, l.getProfile(), outcome.leftName());
StructureDefinition sdr = resolveProfile(ed, outcome, path, r.getProfile(), outcome.rightName());
StructureDefinition sdl = resolveProfile(ed, outcome, path, l.getProfile().get(0).getValue(), outcome.leftName());
StructureDefinition sdr = resolveProfile(ed, outcome, path, r.getProfile().get(0).getValue(), outcome.rightName());
if (sdl != null && sdr != null) {
if (sdl == sdr) {
pfound = true;
@ -804,7 +807,7 @@ public class ProfileComparer {
ProfileComparison comp = compareProfiles(sdl, sdr);
if (comp.getSubset() != null) {
pfound = true;
c.setProfile("#"+comp.id);
c.addProfile("#"+comp.id);
}
}
}
@ -817,8 +820,8 @@ public class ProfileComparer {
tfound = true;
c.setTargetProfile(r.getTargetProfile());
} else {
StructureDefinition sdl = resolveProfile(ed, outcome, path, l.getProfile(), outcome.leftName());
StructureDefinition sdr = resolveProfile(ed, outcome, path, r.getProfile(), outcome.rightName());
StructureDefinition sdl = resolveProfile(ed, outcome, path, l.getProfile().get(0).getValue(), outcome.leftName());
StructureDefinition sdr = resolveProfile(ed, outcome, path, r.getProfile().get(0).getValue(), outcome.rightName());
if (sdl != null && sdr != null) {
if (sdl == sdr) {
tfound = true;
@ -831,7 +834,7 @@ public class ProfileComparer {
ProfileComparison comp = compareProfiles(sdl, sdr);
if (comp.getSubset() != null) {
tfound = true;
c.setTargetProfile("#"+comp.id);
c.addTargetProfile("#"+comp.id);
}
}
}
@ -852,7 +855,7 @@ public class ProfileComparer {
return res;
}
private Collection<? extends TypeRefComponent> unionTypes(String path, List<TypeRefComponent> left, List<TypeRefComponent> right) throws DefinitionException, IOException {
private Collection<? extends TypeRefComponent> unionTypes(String path, List<TypeRefComponent> left, List<TypeRefComponent> right) throws DefinitionException, IOException, FHIRFormatError {
List<TypeRefComponent> result = new ArrayList<TypeRefComponent>();
for (TypeRefComponent l : left)
checkAddTypeUnion(path, result, l);
@ -861,7 +864,7 @@ public class ProfileComparer {
return result;
}
private void checkAddTypeUnion(String path, List<TypeRefComponent> results, TypeRefComponent nw) throws DefinitionException, IOException {
private void checkAddTypeUnion(String path, List<TypeRefComponent> results, TypeRefComponent nw) throws DefinitionException, IOException, FHIRFormatError {
boolean pfound = false;
boolean tfound = false;
nw = nw.copy();
@ -878,8 +881,8 @@ public class ProfileComparer {
ex.setProfile(null);
} else {
// both have profiles. Is one derived from the other?
StructureDefinition sdex = context.fetchResource(StructureDefinition.class, ex.getProfile());
StructureDefinition sdnw = context.fetchResource(StructureDefinition.class, nw.getProfile());
StructureDefinition sdex = context.fetchResource(StructureDefinition.class, ex.getProfile().get(0).getValue());
StructureDefinition sdnw = context.fetchResource(StructureDefinition.class, nw.getProfile().get(0).getValue());
if (sdex != null && sdnw != null) {
if (sdex == sdnw) {
pfound = true;
@ -892,7 +895,7 @@ public class ProfileComparer {
ProfileComparison comp = compareProfiles(sdex, sdnw);
if (comp.getSuperset() != null) {
pfound = true;
ex.setProfile("#"+comp.id);
ex.addProfile("#"+comp.id);
}
}
}
@ -906,8 +909,8 @@ public class ProfileComparer {
ex.setTargetProfile(null);
} else {
// both have profiles. Is one derived from the other?
StructureDefinition sdex = context.fetchResource(StructureDefinition.class, ex.getTargetProfile());
StructureDefinition sdnw = context.fetchResource(StructureDefinition.class, nw.getTargetProfile());
StructureDefinition sdex = context.fetchResource(StructureDefinition.class, ex.getTargetProfile().get(0).getValue());
StructureDefinition sdnw = context.fetchResource(StructureDefinition.class, nw.getTargetProfile().get(0).getValue());
if (sdex != null && sdnw != null) {
if (sdex == sdnw) {
tfound = true;
@ -920,7 +923,7 @@ public class ProfileComparer {
ProfileComparison comp = compareProfiles(sdex, sdnw);
if (comp.getSuperset() != null) {
tfound = true;
ex.setTargetProfile("#"+comp.id);
ex.addTargetProfile("#"+comp.id);
}
}
}
@ -938,27 +941,6 @@ public class ProfileComparer {
return left.hasBaseDefinition() && left.getBaseDefinition().equals(right.getUrl());
}
// result.addAll(left);
// for (TypeRefComponent r : right) {
// boolean found = false;
// TypeRefComponent c = r.copy();
// for (TypeRefComponent l : left)
// if (Utilities.equals(l.getCode(), r.getCode())) {
//
// }
// if (l.getCode().equals("Reference") && r.getCode().equals("Reference")) {
// if (Base.compareDeep(l.getProfile(), r.getProfile(), false)) {
// found = true;
// }
// } else
// found = true;
// // todo: compare profiles
// // todo: compare aggregation values
// }
// if (!found)
// result.add(c);
// }
// }
private String mergeText(ElementDefinition ed, ProfileComparison outcome, String path, String name, String left, String right) {
if (left == null && right == null)

View File

@ -1,19 +1,65 @@
package org.hl7.fhir.r4.conformance;
import java.io.ByteArrayOutputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.apache.commons.lang3.StringUtils;
import org.hl7.fhir.exceptions.DefinitionException;
import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.r4.conformance.ProfileUtilities.ProfileKnowledgeProvider.BindingResolution;
import org.hl7.fhir.r4.context.IWorkerContext;
import org.hl7.fhir.r4.context.IWorkerContext.ValidationResult;
import org.hl7.fhir.r4.elementmodel.ObjectConverter;
import org.hl7.fhir.r4.elementmodel.Property;
import org.hl7.fhir.r4.formats.IParser;
import org.hl7.fhir.r4.model.*;
import org.hl7.fhir.r4.model.ElementDefinition.*;
import org.hl7.fhir.r4.formats.IParser.OutputStyle;
import org.hl7.fhir.r4.formats.XmlParser;
import org.hl7.fhir.r4.model.Base;
import org.hl7.fhir.r4.model.BooleanType;
import org.hl7.fhir.r4.model.CodeType;
import org.hl7.fhir.r4.model.CodeableConcept;
import org.hl7.fhir.r4.model.Coding;
import org.hl7.fhir.r4.model.Element;
import org.hl7.fhir.r4.model.ElementDefinition;
import org.hl7.fhir.r4.model.ElementDefinition.AggregationMode;
import org.hl7.fhir.r4.model.ElementDefinition.DiscriminatorType;
import org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionBaseComponent;
import org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionBindingComponent;
import org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionConstraintComponent;
import org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionExampleComponent;
import org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionMappingComponent;
import org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionSlicingComponent;
import org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent;
import org.hl7.fhir.r4.model.ElementDefinition.SlicingRules;
import org.hl7.fhir.r4.model.ElementDefinition.TypeRefComponent;
import org.hl7.fhir.r4.model.Enumeration;
import org.hl7.fhir.r4.model.Enumerations.BindingStrength;
import org.hl7.fhir.r4.model.StructureDefinition.*;
import org.hl7.fhir.r4.model.Extension;
import org.hl7.fhir.r4.model.IntegerType;
import org.hl7.fhir.r4.model.PrimitiveType;
import org.hl7.fhir.r4.model.Quantity;
import org.hl7.fhir.r4.model.Reference;
import org.hl7.fhir.r4.model.Resource;
import org.hl7.fhir.r4.model.StringType;
import org.hl7.fhir.r4.model.StructureDefinition;
import org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionContextComponent;
import org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionDifferentialComponent;
import org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKind;
import org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionMappingComponent;
import org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionSnapshotComponent;
import org.hl7.fhir.r4.model.StructureDefinition.TypeDerivationRule;
import org.hl7.fhir.r4.model.Type;
import org.hl7.fhir.r4.model.UriType;
import org.hl7.fhir.r4.model.ValueSet;
import org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionComponent;
import org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionContainsComponent;
import org.hl7.fhir.r4.terminologies.ValueSetExpander.ValueSetExpansionOutcome;
@ -21,6 +67,8 @@ import org.hl7.fhir.r4.utils.NarrativeGenerator;
import org.hl7.fhir.r4.utils.ToolingExtensions;
import org.hl7.fhir.r4.utils.TranslatingUtilities;
import org.hl7.fhir.r4.utils.formats.CSVWriter;
import org.hl7.fhir.exceptions.DefinitionException;
import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.utilities.CommaSeparatedStringBuilder;
import org.hl7.fhir.utilities.Utilities;
import org.hl7.fhir.utilities.validation.ValidationMessage;
@ -36,10 +84,6 @@ import org.hl7.fhir.utilities.xml.SchematronWriter.Rule;
import org.hl7.fhir.utilities.xml.SchematronWriter.SchematronType;
import org.hl7.fhir.utilities.xml.SchematronWriter.Section;
import java.io.IOException;
import java.io.OutputStream;
import java.util.*;
/**
* This class provides a set of utility operations for working with Profiles.
* Key functionality:
@ -93,9 +137,9 @@ public class ProfileUtilities extends TranslatingUtilities {
this.pkp = pkp;
}
private boolean allTypesAre(List<TypeRefComponent> types, String name) {
private boolean allAreReference(List<TypeRefComponent> types) {
for (TypeRefComponent t : types) {
if (!t.getCode().equals(name))
if (!t.hasTarget())
return false;
}
return true;
@ -333,7 +377,7 @@ public class ProfileUtilities extends TranslatingUtilities {
case BUNDLED : return "b";
case CONTAINED : return "c";
case REFERENCED: return "r";
default: return "?";
default: return "?";
}
}
@ -611,13 +655,13 @@ public class ProfileUtilities extends TranslatingUtilities {
}
}
private void genElement(String defPath, HierarchicalTableGenerator gen, List<Row> rows, ElementDefinition element, List<ElementDefinition> all, List<StructureDefinition> profiles, boolean showMissing, String profileBaseFileName, Boolean extensions, boolean snapshot, String corePath, String imagePath, boolean root, boolean logicalModel, boolean isConstraintMode, boolean allInvariants) throws IOException {
private void genElement(String defPath, HierarchicalTableGenerator gen, List<Row> rows, ElementDefinition element, List<ElementDefinition> all, List<StructureDefinition> profiles, boolean showMissing, String profileBaseFileName, Boolean extensions, boolean snapshot, String corePath, String imagePath, boolean root, boolean logicalModel, boolean isConstraintMode, boolean allInvariants) throws IOException, FHIRException {
StructureDefinition profile = profiles == null ? null : profiles.get(profiles.size()-1);
String s = tail(element.getPath());
List<ElementDefinition> children = getChildren(all, element);
boolean isExtension = (s.equals("extension") || s.equals("modifierExtension"));
if (!snapshot && isExtension && extensions != null && extensions != isExtension)
return;
// if (!snapshot && isExtension && extensions != null && extensions != isExtension)
// return;
if (!onlyInformationIsMapping(all, element)) {
Row row = gen.new Row();
@ -632,20 +676,20 @@ public class ProfileUtilities extends TranslatingUtilities {
boolean hasDef = element != null;
boolean ext = false;
if (s.equals("extension")) {
if (element.hasType() && element.getType().get(0).hasProfile() && extensionIsComplex(element.getType().get(0).getProfile()))
if (element.hasType() && element.getType().get(0).hasProfile() && extensionIsComplex(element.getType().get(0).getProfile().get(0).getValue()))
row.setIcon("icon_extension_complex.png", HierarchicalTableGenerator.TEXT_ICON_EXTENSION_COMPLEX);
else
row.setIcon("icon_extension_simple.png", HierarchicalTableGenerator.TEXT_ICON_EXTENSION_SIMPLE);
ext = true;
} else if (s.equals("modifierExtension")) {
if (element.hasType() && element.getType().get(0).hasProfile() && extensionIsComplex(element.getType().get(0).getProfile()))
if (element.hasType() && element.getType().get(0).hasProfile() && extensionIsComplex(element.getType().get(0).getProfile().get(0).getValue()))
row.setIcon("icon_modifier_extension_complex.png", HierarchicalTableGenerator.TEXT_ICON_EXTENSION_COMPLEX);
else
row.setIcon("icon_modifier_extension_simple.png", HierarchicalTableGenerator.TEXT_ICON_EXTENSION_SIMPLE);
} else if (!hasDef || element.getType().size() == 0)
row.setIcon("icon_element.gif", HierarchicalTableGenerator.TEXT_ICON_ELEMENT);
else if (hasDef && element.getType().size() > 1) {
if (allTypesAre(element.getType(), "Reference"))
if (allAreReference(element.getType()))
row.setIcon("icon_reference.png", HierarchicalTableGenerator.TEXT_ICON_REFERENCE);
else
row.setIcon("icon_choice.gif", HierarchicalTableGenerator.TEXT_ICON_CHOICE);
@ -653,7 +697,7 @@ public class ProfileUtilities extends TranslatingUtilities {
row.setIcon("icon_reuse.png", HierarchicalTableGenerator.TEXT_ICON_REUSE);
else if (hasDef && isPrimitive(element.getType().get(0).getCode()))
row.setIcon("icon_primitive.png", HierarchicalTableGenerator.TEXT_ICON_PRIMITIVE);
else if (hasDef && isReference(element.getType().get(0).getCode()))
else if (hasDef && element.getType().get(0).hasTarget())
row.setIcon("icon_reference.png", HierarchicalTableGenerator.TEXT_ICON_REFERENCE);
else if (hasDef && isDataType(element.getType().get(0).getCode()))
row.setIcon("icon_datatype.gif", HierarchicalTableGenerator.TEXT_ICON_DATATYPE);
@ -678,13 +722,14 @@ public class ProfileUtilities extends TranslatingUtilities {
ExtensionContext extDefn = null;
if (ext) {
if (element != null && element.getType().size() == 1 && element.getType().get(0).hasProfile()) {
extDefn = locateExtension(StructureDefinition.class, element.getType().get(0).getProfile());
String eurl = element.getType().get(0).getProfile().get(0).getValue();
extDefn = locateExtension(StructureDefinition.class, eurl);
if (extDefn == null) {
genCardinality(gen, element, row, hasDef, used, null);
row.getCells().add(gen.new Cell(null, null, "?? "+element.getType().get(0).getProfile(), null, null));
generateDescription(gen, row, element, null, used.used, profile.getUrl(), element.getType().get(0).getProfile(), profile, corePath, imagePath, root, logicalModel, allInvariants);
generateDescription(gen, row, element, null, used.used, profile.getUrl(), eurl, profile, corePath, imagePath, root, logicalModel, allInvariants);
} else {
String name = urltail(element.getType().get(0).getProfile());
String name = urltail(eurl);
left.getPieces().get(0).setText(name);
// left.getPieces().get(0).setReference((String) extDefn.getExtensionStructure().getTag("filename"));
left.getPieces().get(0).setHint(translate("sd.table", "Extension URL")+" = "+extDefn.getUrl());
@ -738,15 +783,15 @@ public class ProfileUtilities extends TranslatingUtilities {
for (ElementDefinition child : children)
if (logicalModel || !child.getPath().endsWith(".id") || (child.getPath().endsWith(".id") && (profile != null) && (profile.getDerivation() == TypeDerivationRule.CONSTRAINT)))
genElement(defPath, gen, row.getSubRows(), child, all, profiles, showMissing, profileBaseFileName, isExtension, snapshot, corePath, imagePath, false, logicalModel, isConstraintMode, allInvariants);
if (!snapshot && (extensions == null || !extensions))
for (ElementDefinition child : children)
if (child.getPath().endsWith(".extension") || child.getPath().endsWith(".modifierExtension"))
genElement(defPath, gen, row.getSubRows(), child, all, profiles, showMissing, profileBaseFileName, true, false, corePath, imagePath, false, logicalModel, isConstraintMode, allInvariants);
// if (!snapshot && (extensions == null || !extensions))
// for (ElementDefinition child : children)
// if (child.getPath().endsWith(".extension") || child.getPath().endsWith(".modifierExtension"))
// genElement(defPath, gen, row.getSubRows(), child, all, profiles, showMissing, profileBaseFileName, true, false, corePath, imagePath, false, logicalModel, isConstraintMode, allInvariants);
}
}
}
private void genGridElement(String defPath, HierarchicalTableGenerator gen, List<Row> rows, ElementDefinition element, List<ElementDefinition> all, List<StructureDefinition> profiles, boolean showMissing, String profileBaseFileName, Boolean extensions, String corePath, String imagePath, boolean root, boolean isConstraintMode) throws IOException {
private void genGridElement(String defPath, HierarchicalTableGenerator gen, List<Row> rows, ElementDefinition element, List<ElementDefinition> all, List<StructureDefinition> profiles, boolean showMissing, String profileBaseFileName, Boolean extensions, String corePath, String imagePath, boolean root, boolean isConstraintMode) throws IOException, FHIRException {
StructureDefinition profile = profiles == null ? null : profiles.get(profiles.size()-1);
String s = tail(element.getPath());
List<ElementDefinition> children = getChildren(all, element);
@ -846,98 +891,43 @@ public class ProfileUtilities extends TranslatingUtilities {
}
boolean first = true;
Element source = types.get(0); // either all types are the same, or we don't consider any of them the same
int aggMode = AGG_NONE;
boolean allReference = !types.isEmpty();
Set<AggregationMode> aggs = new HashSet<ElementDefinition.AggregationMode>();
for (TypeRefComponent t : types) {
if (t.getCode()!=null && t.getCode().equals("Reference") && t.hasProfile()) {
for (Enumeration<AggregationMode> en : t.getAggregation())
aggs.add(en.getValue());
} else
allReference = false;
}
if (allReference) {
if (aggs.size() > 0) {
boolean allSame = true;
for (TypeRefComponent t : types) {
for (AggregationMode agg : aggs) {
boolean found = false;
for (Enumeration<AggregationMode> en : t.getAggregation())
if (en.getValue() == agg)
found = true;
if (!found)
allSame = false;
}
}
aggMode = allSame ? AGG_GR : AGG_IND;
if (aggMode != AGG_GR)
allReference = false;
}
} else
aggMode = aggs.size() == 0 ? AGG_NONE : AGG_IND;
if (allReference) {
c.getPieces().add(gen.new Piece(corePath+"references.html", "Reference", null));
c.getPieces().add(gen.new Piece(null, "(", null));
}
TypeRefComponent tl = null;
for (TypeRefComponent t : types) {
if (first)
first = false;
else if (allReference)
c.addPiece(checkForNoChange(tl, gen.new Piece(null," | ", null)));
else
c.addPiece(checkForNoChange(tl, gen.new Piece(null,", ", null)));
tl = t;
if (t.getCode()!= null && t.getCode().equals("Reference")) {
if (!allReference) {
c.getPieces().add(gen.new Piece(corePath+"references.html", "Reference", null));
c.getPieces().add(gen.new Piece(null, "(", null));
}
if (t.hasTargetProfile() && t.getTargetProfile().startsWith("http://hl7.org/fhir/StructureDefinition/")) {
StructureDefinition sd = context.fetchResource(StructureDefinition.class, t.getTargetProfile());
if (sd != null) {
String disp = sd.hasTitle() ? sd.getTitle() : sd.getName();
c.addPiece(checkForNoChange(t, gen.new Piece(checkPrepend(corePath, sd.getUserString("path")), disp, null)));
} else {
String rn = t.getTargetProfile().substring(40);
c.addPiece(checkForNoChange(t, gen.new Piece(pkp.getLinkFor(corePath, rn), rn, null)));
}
} else if (t.hasTargetProfile() && Utilities.isAbsoluteUrl(t.getTargetProfile())) {
StructureDefinition sd = context.fetchResource(StructureDefinition.class, t.getTargetProfile());
if (sd != null) {
String disp = sd.hasTitle() ? sd.getTitle() : sd.getName();
String ref = pkp.getLinkForProfile(null, sd.getUrl());
if (ref.contains("|"))
ref = ref.substring(0, ref.indexOf("|"));
c.addPiece(checkForNoChange(t, gen.new Piece(ref, disp, null)));
} else
c.addPiece(checkForNoChange(t, gen.new Piece(null, t.getTargetProfile(), null)));
} else if (t.hasTargetProfile() && t.getTargetProfile().startsWith("#"))
c.addPiece(checkForNoChange(t, gen.new Piece(corePath+profileBaseFileName+"."+t.getTargetProfile().substring(1).toLowerCase()+".html", t.getTargetProfile(), null)));
else if (t.hasTargetProfile())
c.addPiece(checkForNoChange(t, gen.new Piece(corePath+t.getTargetProfile(), t.getTargetProfile(), null)));
if (!allReference) {
c.getPieces().add(gen.new Piece(null, ")", null));
if (t.getAggregation().size() > 0) {
c.getPieces().add(gen.new Piece(corePath+"valueset-resource-aggregation-mode.html", " {", null));
boolean firstA = true;
for (Enumeration<AggregationMode> a : t.getAggregation()) {
if (firstA = true)
firstA = false;
else
c.getPieces().add(gen.new Piece(corePath+"valueset-resource-aggregation-mode.html", ", ", null));
c.getPieces().add(gen.new Piece(corePath+"valueset-resource-aggregation-mode.html", codeForAggregation(a.getValue()), null));
if (t.hasTarget()) {
c.getPieces().add(gen.new Piece(corePath+"references.html", t.getCode(), null));
c.getPieces().add(gen.new Piece(null, "(", null));
for (UriType u : t.getTargetProfile()) {
if (u.getValue().startsWith("http://hl7.org/fhir/StructureDefinition/")) {
StructureDefinition sd = context.fetchResource(StructureDefinition.class, u.getValue());
if (sd != null) {
String disp = sd.hasTitle() ? sd.getTitle() : sd.getName();
c.addPiece(checkForNoChange(t, gen.new Piece(checkPrepend(corePath, sd.getUserString("path")), disp, null)));
} else {
String rn = u.getValue().substring(40);
c.addPiece(checkForNoChange(t, gen.new Piece(pkp.getLinkFor(corePath, rn), rn, null)));
}
c.getPieces().add(gen.new Piece(corePath+"valueset-resource-aggregation-mode.html", "}", null));
}
} else if (Utilities.isAbsoluteUrl(u.getValue())) {
StructureDefinition sd = context.fetchResource(StructureDefinition.class, u.getValue());
if (sd != null) {
String disp = sd.hasTitle() ? sd.getTitle() : sd.getName();
String ref = pkp.getLinkForProfile(null, sd.getUrl());
if (ref.contains("|"))
ref = ref.substring(0, ref.indexOf("|"));
c.addPiece(checkForNoChange(t, gen.new Piece(ref, disp, null)));
} else
c.addPiece(checkForNoChange(t, gen.new Piece(null, u.getValue(), null)));
} else if (t.hasTargetProfile() && u.getValue().startsWith("#"))
c.addPiece(checkForNoChange(t, gen.new Piece(corePath+profileBaseFileName+"."+u.getValue().substring(1).toLowerCase()+".html", u.getValue(), null)));
}
} else if (t.hasProfile() && (!t.getCode().equals("Extension") || t.getProfile().contains(":"))) { // a profiled type
String ref;
ref = pkp.getLinkForProfile(profile, t.getProfile());
ref = pkp.getLinkForProfile(profile, t.getProfile().get(0).getValue());
if (ref != null) {
String[] parts = ref.split("\\|");
if (parts[0].startsWith("http:") || parts[0].startsWith("https:")) {
@ -945,30 +935,15 @@ public class ProfileUtilities extends TranslatingUtilities {
c.addPiece(checkForNoChange(t, gen.new Piece(parts[0], parts[1], t.getCode())));
} else {
// c.addPiece(checkForNoChange(t, gen.new Piece((t.getProfile().startsWith(corePath)? corePath: "")+parts[0], "<" + parts[1] + ">", t.getCode())));
c.addPiece(checkForNoChange(t, gen.new Piece((t.getProfile().startsWith(corePath)? corePath: "")+parts[0], parts[1], t.getCode())));
c.addPiece(checkForNoChange(t, gen.new Piece((t.getProfile().get(0).getValue().startsWith(corePath)? corePath: "")+parts[0], parts[1], t.getCode())));
}
} else
c.addPiece(checkForNoChange(t, gen.new Piece((t.getProfile().startsWith(corePath)? corePath: "")+ref, t.getCode(), null)));
c.addPiece(checkForNoChange(t, gen.new Piece((t.getProfile().get(0).getValue().startsWith(corePath)? corePath: "")+ref, t.getCode(), null)));
} else if (pkp.hasLinkFor(t.getCode())) {
c.addPiece(checkForNoChange(t, gen.new Piece(pkp.getLinkFor(corePath, t.getCode()), t.getCode(), null)));
} else
c.addPiece(checkForNoChange(t, gen.new Piece(null, t.getCode(), null)));
}
if (allReference) {
c.getPieces().add(gen.new Piece(null, ")", null));
if (aggs.size() > 0) {
c.getPieces().add(gen.new Piece(corePath+"valueset-resource-aggregation-mode.html", " {", null));
boolean firstA = true;
for (AggregationMode a : aggs) {
if (firstA = true)
firstA = false;
else
c.getPieces().add(gen.new Piece(corePath+"valueset-resource-aggregation-mode.html", ", ", null));
c.getPieces().add(gen.new Piece(corePath+"valueset-resource-aggregation-mode.html", codeForAggregation(a), null));
}
c.getPieces().add(gen.new Piece(corePath+"valueset-resource-aggregation-mode.html", "}", null));
}
}
return c;
}
@ -985,11 +960,11 @@ public class ProfileUtilities extends TranslatingUtilities {
csv.dump();
}
private Cell generateDescription(HierarchicalTableGenerator gen, Row row, ElementDefinition definition, ElementDefinition fallback, boolean used, String baseURL, String url, StructureDefinition profile, String corePath, String imagePath, boolean root, boolean logicalModel, boolean allInvariants) throws IOException {
private Cell generateDescription(HierarchicalTableGenerator gen, Row row, ElementDefinition definition, ElementDefinition fallback, boolean used, String baseURL, String url, StructureDefinition profile, String corePath, String imagePath, boolean root, boolean logicalModel, boolean allInvariants) throws IOException, FHIRException {
return generateDescription(gen, row, definition, fallback, used, baseURL, url, profile, corePath, imagePath, root, logicalModel, allInvariants, null);
}
private Cell generateDescription(HierarchicalTableGenerator gen, Row row, ElementDefinition definition, ElementDefinition fallback, boolean used, String baseURL, String url, StructureDefinition profile, String corePath, String imagePath, boolean root, boolean logicalModel, boolean allInvariants, ElementDefinition valueDefn) throws IOException {
private Cell generateDescription(HierarchicalTableGenerator gen, Row row, ElementDefinition definition, ElementDefinition fallback, boolean used, String baseURL, String url, StructureDefinition profile, String corePath, String imagePath, boolean root, boolean logicalModel, boolean allInvariants, ElementDefinition valueDefn) throws IOException, FHIRException {
Cell c = gen.new Cell();
row.getCells().add(c);
@ -1242,47 +1217,6 @@ public class ProfileUtilities extends TranslatingUtilities {
}
}
private void generateForChildren(SchematronWriter sch, String xpath, ElementDefinition ed, StructureDefinition structure, StructureDefinition base) throws IOException {
// generateForChild(txt, structure, child);
List<ElementDefinition> children = getChildList(structure, ed);
String sliceName = null;
ElementDefinitionSlicingComponent slicing = null;
for (ElementDefinition child : children) {
String name = tail(child.getPath());
if (child.hasSlicing()) {
sliceName = name;
slicing = child.getSlicing();
} else if (!name.equals(sliceName))
slicing = null;
ElementDefinition based = getByPath(base, child.getPath());
boolean doMin = (child.getMin() > 0) && (based == null || (child.getMin() != based.getMin()));
boolean doMax = child.hasMax() && !child.getMax().equals("*") && (based == null || (!child.getMax().equals(based.getMax())));
Slicer slicer = slicing == null ? new Slicer(true) : generateSlicer(child, slicing, structure);
if (slicer.check) {
if (doMin || doMax) {
Section s = sch.section(xpath);
Rule r = s.rule(xpath);
if (doMin)
r.assrt("count(f:"+name+slicer.criteria+") >= "+Integer.toString(child.getMin()), name+slicer.name+": minimum cardinality of '"+name+"' is "+Integer.toString(child.getMin()));
if (doMax)
r.assrt("count(f:"+name+slicer.criteria+") <= "+child.getMax(), name+slicer.name+": maximum cardinality of '"+name+"' is "+child.getMax());
}
}
}
for (ElementDefinitionConstraintComponent inv : ed.getConstraint()) {
if (inv.hasXpath()) {
Section s = sch.section(ed.getPath());
Rule r = s.rule(xpath);
r.assrt(inv.getXpath(), (inv.hasId() ? inv.getId()+": " : "")+inv.getHuman()+(inv.hasUserData(IS_DERIVED) ? " (inherited)" : ""));
}
}
for (ElementDefinition child : children) {
String name = tail(child.getPath());
generateForChildren(sch, xpath+"/f:"+name, child, structure, base);
}
}
public XhtmlNode generateGrid(String defFile, StructureDefinition profile, String imageFolder, boolean inlineGraphics, String profileBaseFileName, String corePath, String imagePath, Set<String> outputTracker) throws IOException, FHIRException {
HierarchicalTableGenerator gen = new HierarchicalTableGenerator(imageFolder, inlineGraphics);
gen.setTranslator(getTranslator());
@ -1298,7 +1232,7 @@ public class ProfileUtilities extends TranslatingUtilities {
}
}
private Cell generateGridDescription(HierarchicalTableGenerator gen, Row row, ElementDefinition definition, ElementDefinition fallback, boolean used, String baseURL, String url, StructureDefinition profile, String corePath, String imagePath, boolean root, ElementDefinition valueDefn) throws IOException {
private Cell generateGridDescription(HierarchicalTableGenerator gen, Row row, ElementDefinition definition, ElementDefinition fallback, boolean used, String baseURL, String url, StructureDefinition profile, String corePath, String imagePath, boolean root, ElementDefinition valueDefn) throws IOException, FHIRException {
Cell c = gen.new Cell();
row.getCells().add(c);
@ -1463,39 +1397,6 @@ public class ProfileUtilities extends TranslatingUtilities {
}
// generate schematrons for the rules in a structure definition
public void generateSchematrons(OutputStream dest, StructureDefinition structure) throws IOException, DefinitionException {
if (structure.getDerivation() != TypeDerivationRule.CONSTRAINT)
throw new DefinitionException("not the right kind of structure to generate schematrons for");
if (!structure.hasSnapshot())
throw new DefinitionException("needs a snapshot");
StructureDefinition base = context.fetchResource(StructureDefinition.class, structure.getBaseDefinition());
SchematronWriter sch = new SchematronWriter(dest, SchematronType.PROFILE, base.getName());
ElementDefinition ed = structure.getSnapshot().getElement().get(0);
generateForChildren(sch, "f:"+ed.getPath(), ed, structure, base);
sch.dump();
}
private Slicer generateSlicer(ElementDefinition child, ElementDefinitionSlicingComponent slicing, StructureDefinition structure) {
// given a child in a structure, it's sliced. figure out the slicing xpath
if (child.getPath().endsWith(".extension")) {
ElementDefinition ued = getUrlFor(structure, child);
if ((ued == null || !ued.hasFixed()) && !(child.hasType() && (child.getType().get(0).hasProfile())))
return new Slicer(false);
else {
Slicer s = new Slicer(true);
String url = (ued == null || !ued.hasFixed()) ? child.getType().get(0).getProfile() : ((UriType) ued.getFixed()).asStringValue();
s.name = " with URL = '"+url+"'";
s.criteria = "[@url = '"+url+"']";
return s;
}
} else
return new Slicer(false);
}
/**
* Given a base (snapshot) profile structure, and a differential profile, generate a new snapshot profile
*
@ -1521,6 +1422,7 @@ public class ProfileUtilities extends TranslatingUtilities {
derived.setSnapshot(new StructureDefinitionSnapshotComponent());
// so we have two lists - the base list, and the differential list
// the differential list is only allowed to include things that are in the base list, but
// is allowed to include them multiple times - thereby slicing them
@ -1537,6 +1439,7 @@ public class ProfileUtilities extends TranslatingUtilities {
e.clearUserData(GENERATED_IN_SNAPSHOT);
// we actually delegate the work to a subroutine so we can re-enter it with a different cursors
processPaths("", derived.getSnapshot(), base.getSnapshot(), derived.getDifferential(), baseCursor, diffCursor, base.getSnapshot().getElement().size()-1,
derived.getDifferential().hasElement() ? derived.getDifferential().getElement().size()-1 : -1, url, derived.getId(), null, null, false, base.getUrl(), null, false, null);
if (!derived.getSnapshot().getElementFirstRep().getType().isEmpty())
@ -1560,6 +1463,13 @@ public class ProfileUtilities extends TranslatingUtilities {
// System.out.println("**BAD Differential element: " + profileName + ":" + e.getId());
}
}
if (derived.getDerivation() == TypeDerivationRule.SPECIALIZATION) {
for (ElementDefinition ed : derived.getSnapshot().getElement()) {
if (!ed.hasBase()) {
ed.getBase().setPath(ed.getPath()).setMin(ed.getMin()).setMax(ed.getMax());
}
}
}
}
public XhtmlNode generateSpanningTable(StructureDefinition profile, String imageFolder, boolean onlyConstraints, String constraintPrefix, Set<String> outputTracker) throws IOException, FHIRException {
@ -1587,7 +1497,7 @@ public class ProfileUtilities extends TranslatingUtilities {
try {
return gen.generate(model, imagePath, 0, outputTracker);
} catch (org.hl7.fhir.exceptions.FHIRException e) {
throw new FHIRException(e.getMessage(), e);
throw new FHIRException("Error generating table for profile " + profile.getUrl() + ": " + e.getMessage(), e);
}
}
@ -1711,7 +1621,7 @@ public class ProfileUtilities extends TranslatingUtilities {
private StructureDefinition getProfileForDataType(TypeRefComponent type) {
StructureDefinition sd = null;
if (type.hasProfile()) {
sd = context.fetchResource(StructureDefinition.class, type.getProfile());
sd = context.fetchResource(StructureDefinition.class, type.getProfile().get(0).getValue());
if (sd == null)
System.out.println("Failed to find referenced profile: " + type.getProfile());
}
@ -1888,7 +1798,7 @@ public class ProfileUtilities extends TranslatingUtilities {
public boolean isIgmode() {
return igmode;
}
public void setIgmode(boolean igmode) {
this.igmode = igmode;
}
@ -1914,7 +1824,7 @@ public class ProfileUtilities extends TranslatingUtilities {
private boolean isKeyProperty(String path) {
return Utilities.existsInList(path, "Observation.code");
}
private boolean isLargerMax(String derived, String base) {
if ("*".equals(base))
return false;
@ -1922,31 +1832,12 @@ public class ProfileUtilities extends TranslatingUtilities {
return true;
return Integer.parseInt(derived) > Integer.parseInt(base);
}
/*
private List<Piece> markdownToPieces(String markdown) throws FHIRException {
String htmlString = Processor.process(markdown);
XhtmlParser parser = new XhtmlParser();
try {
XhtmlNode node = parser.parseFragment(htmlString);
return htmlToPieces(node);
} catch (IOException e) {
}
return null;
}
private List<Piece> htmlToPieces(XhtmlNode n) {
}*/
public boolean isPrimitive(String value) {
StructureDefinition sd = context.fetchResource(StructureDefinition.class, "http://hl7.org/fhir/StructureDefinition/"+value);
return sd != null && sd.getKind() == StructureDefinitionKind.PRIMITIVETYPE;
}
private boolean isReference(String value) {
return "Reference".equals(value);
}
private boolean isSlicedToOneOnly(ElementDefinition e) {
return (e.hasSlicing() && e.hasMaxElement() && e.getMax().equals("1"));
}
@ -1959,10 +1850,11 @@ public class ProfileUtilities extends TranslatingUtilities {
List<String> res = new ArrayList<String>();
for (TypeRefComponent tr : ed.getType()) {
// code is null if we're dealing with "value" and profile is null if we just have Reference()
if (tr.getCode()!= null && "Reference".equals(tr.getCode()) && tr.getTargetProfile() != null)
res.add(tr.getTargetProfile());
if (tr.hasTarget() && tr.hasTargetProfile())
for (UriType u : tr.getTargetProfile())
res.add(u.getValue());
}
return res ;
return res;
}
private ExtensionContext locateExtension(Class<StructureDefinition> class1, String value) {
@ -2025,22 +1917,6 @@ public class ProfileUtilities extends TranslatingUtilities {
!d.hasBinding();
}
// private static String listStructures(StructureDefinition p) {
// StringBuilder b = new StringBuilder();
// boolean first = true;
// for (ProfileStructureComponent s : p.getStructure()) {
// if (first)
// first = false;
// else
// b.append(", ");
// if (pkp != null && pkp.hasLinkFor(s.getType()))
// b.append("<a href=\""+pkp.getLinkFor(s.getType())+"\">"+s.getType()+"</a>");
// else
// b.append(s.getType());
// }
// return b.toString();
// }
private boolean orderMatches(BooleanType diff, BooleanType base) {
return (diff == null) || (base == null) || (diff.getValue() == base.getValue());
}
@ -2087,6 +1963,10 @@ public class ProfileUtilities extends TranslatingUtilities {
res.setBinding(usage.getBinding().copy());
for (ElementDefinitionConstraintComponent c : usage.getConstraint())
res.addConstraint(c);
for (Extension e : usage.getExtension()) {
if (!res.hasExtension(e.getUrl()))
res.addExtension(e.copy());
}
return res;
}
@ -2099,6 +1979,22 @@ public class ProfileUtilities extends TranslatingUtilities {
return p1.startsWith(p2);
}
// private static String listStructures(StructureDefinition p) {
// StringBuilder b = new StringBuilder();
// boolean first = true;
// for (ProfileStructureComponent s : p.getStructure()) {
// if (first)
// first = false;
// else
// b.append(", ");
// if (pkp != null && pkp.hasLinkFor(s.getType()))
// b.append("<a href=\""+pkp.getLinkFor(s.getType())+"\">"+s.getType()+"</a>");
// else
// b.append(s.getType());
// }
// return b.toString();
// }
private String pathTail(List<ElementDefinition> diffMatches, int i) {
ElementDefinition d = diffMatches.get(i);
@ -2183,7 +2079,7 @@ public class ProfileUtilities extends TranslatingUtilities {
} else if (diffMatches.size() == 1 && (slicingDone || !(diffMatches.get(0).hasSlicing() || (isExtension(diffMatches.get(0)) && diffMatches.get(0).hasSliceName())))) {// one matching element in the differential
ElementDefinition template = null;
if (diffMatches.get(0).hasType() && diffMatches.get(0).getType().size() == 1 && diffMatches.get(0).getType().get(0).hasProfile() && !diffMatches.get(0).getType().get(0).getCode().equals("Reference")) {
String p = diffMatches.get(0).getType().get(0).getProfile();
String p = diffMatches.get(0).getType().get(0).getProfile().get(0).getValue();
StructureDefinition sd = context.fetchResource(StructureDefinition.class, p);
if (sd != null) {
if (!sd.hasSnapshot()) {
@ -2390,6 +2286,13 @@ public class ProfileUtilities extends TranslatingUtilities {
int ndl = findEndOfElement(differential, ndc);
processPaths(indent+" ", result, base, differential, baseCursor+1, ndc, nbl, ndl, url, profileName+pathTail(diffMatches, 0), contextPathSrc, contextPathDst, trimDifferential, contextName, resultPathBase, true, null);
// throw new Error("Not done yet");
} else if (currentBase.getType().get(0).getCode().equals("BackboneElement") && diffMatches.size() > 0 && diffMatches.get(0).hasSliceName()) {
// We need to copy children of the backbone element before we start messing around with slices
int nbl = findEndOfElement(base, baseCursor);
for (int i = baseCursor+1; i<=nbl; i++) {
outcome = updateURLs(url, base.getElement().get(i).copy());
result.getElement().add(outcome);
}
}
// now, we have two lists, base and diff. we're going to work through base, looking for matches in diff.
@ -2463,18 +2366,31 @@ public class ProfileUtilities extends TranslatingUtilities {
throw new DefinitionException(diffMatches.get(0).getPath()+" has children ("+differential.getElement().get(diffCursor).getPath()+") and multiple types ("+typeCode(outcome.getType())+") in profile "+profileName);
}
TypeRefComponent t = outcome.getType().get(0);
StructureDefinition dt = getProfileForDataType(outcome.getType().get(0));
// if (t.getCode().equals("Extension") && t.hasProfile() && !t.getProfile().contains(":")) {
// lloydfix dt =
// }
if (dt == null)
throw new DefinitionException(diffMatches.get(0).getPath()+" has children ("+differential.getElement().get(diffCursor).getPath()+") for type "+typeCode(outcome.getType())+" in profile "+profileName+", but can't find type");
contextName = dt.getUrl();
int start = diffCursor;
while (differential.getElement().size() > diffCursor && pathStartsWith(differential.getElement().get(diffCursor).getPath(), diffMatches.get(0).getPath()+"."))
diffCursor++;
processPaths(indent+" ", result, dt.getSnapshot(), differential, 1 /* starting again on the data type, but skip the root */, start-1, dt.getSnapshot().getElement().size()-1,
diffCursor - 1, url, profileName+pathTail(diffMatches, 0), diffMatches.get(0).getPath(), outcome.getPath(), trimDifferential, contextName, resultPathBase, false, null);
if (t.getCode().equals("BackboneElement")) {
int baseStart = base.getElement().indexOf(currentBase)+1;
int baseMax = baseStart + 1;
while (baseMax < base.getElement().size() && base.getElement().get(baseMax).getPath().startsWith(currentBase.getPath()+"."))
baseMax++;
int start = diffCursor;
while (differential.getElement().size() > diffCursor && pathStartsWith(differential.getElement().get(diffCursor).getPath(), diffMatches.get(0).getPath()+"."))
diffCursor++;
processPaths(indent+" ", result, base, differential, baseStart, start-1, baseMax-1,
diffCursor - 1, url, profileName+pathTail(diffMatches, 0), base.getElement().get(0).getPath(), base.getElement().get(0).getPath(), trimDifferential, contextName, resultPathBase, false, null);
} else {
StructureDefinition dt = getProfileForDataType(outcome.getType().get(0));
// if (t.getCode().equals("Extension") && t.hasProfile() && !t.getProfile().contains(":")) {
// lloydfix dt =
// }
if (dt == null)
throw new DefinitionException(diffMatches.get(0).getPath()+" has children ("+differential.getElement().get(diffCursor).getPath()+") for type "+typeCode(outcome.getType())+" in profile "+profileName+", but can't find type");
contextName = dt.getUrl();
int start = diffCursor;
while (differential.getElement().size() > diffCursor && pathStartsWith(differential.getElement().get(diffCursor).getPath(), diffMatches.get(0).getPath()+"."))
diffCursor++;
processPaths(indent+" ", result, dt.getSnapshot(), differential, 1 /* starting again on the data type, but skip the root */, start-1, dt.getSnapshot().getElement().size()-1,
diffCursor - 1, url, profileName+pathTail(diffMatches, 0), diffMatches.get(0).getPath(), outcome.getPath(), trimDifferential, contextName, resultPathBase, false, null);
}
} else if (outcome.getType().get(0).getCode().equals("Extension")) {
// Force URL to appear if we're dealing with an extension. (This is a kludge - may need to drill down in other cases where we're slicing and the type has a profile declaration that could be setting the fixed value)
StructureDefinition dt = getProfileForDataType(outcome.getType().get(0));
@ -2532,7 +2448,7 @@ public class ProfileUtilities extends TranslatingUtilities {
generateIds(sd.getSnapshot().getElement(), sd.getUrl());
}
}
private String sliceSummary(ElementDefinition ed) {
if (!ed.hasSlicing() && !ed.hasSliceName())
return "";
@ -2550,7 +2466,7 @@ public class ProfileUtilities extends TranslatingUtilities {
}
return " (slicing by "+b.toString()+")";
}
public void sortDifferential(StructureDefinition base, StructureDefinition diff, String name, List<String> errors) throws FHIRException {
final List<ElementDefinition> diffList = diff.getDifferential().getElement();
@ -2585,7 +2501,7 @@ public class ProfileUtilities extends TranslatingUtilities {
diffList.clear();
writeElements(edh, diffList);
}
private void sortElements(ElementDefinitionHolder edh, ElementDefinitionComparer cmp, List<String> errors) throws FHIRException {
if (edh.getChildren().size() == 1)
// special case - sort needsto allocate base numbers, but there'll be no sort if there's only 1 child. So in that case, we just go ahead and allocated base number directly
@ -2602,7 +2518,7 @@ public class ProfileUtilities extends TranslatingUtilities {
if (ed.getType().isEmpty() || isAbstract(ed.getType().get(0).getCode()) || ed.getType().get(0).getCode().equals(ed.getPath())) {
ccmp = new ElementDefinitionComparer(true, cmp.snapshot, cmp.base, cmp.prefixLength, cmp.name);
} else if (ed.getType().get(0).getCode().equals("Extension") && child.getSelf().getType().size() == 1 && child.getSelf().getType().get(0).hasProfile()) {
StructureDefinition profile = context.fetchResource(StructureDefinition.class, child.getSelf().getType().get(0).getProfile());
StructureDefinition profile = context.fetchResource(StructureDefinition.class, child.getSelf().getType().get(0).getProfile().get(0).getValue());
if (profile==null)
ccmp = null; // this might happen before everything is loaded. And we don't so much care about sot order in this case
else
@ -2651,7 +2567,7 @@ public class ProfileUtilities extends TranslatingUtilities {
}
}
}
private boolean standardExtensionSlicing(ElementDefinition element) {
String t = tail(element.getPath());
return (t.equals("extension") || t.equals("modifierExtension"))
@ -2684,6 +2600,14 @@ public class ProfileUtilities extends TranslatingUtilities {
return system+" "+value.getCode();
}
// private String describeExtension(ElementDefinition ed) {
// if (!ed.hasType() || !ed.getTypeFirstRep().hasProfile())
// return "";
// return "$"+urlTail(ed.getTypeFirstRep().getProfile());
// }
//
private String summarizeSlicing(ElementDefinitionSlicingComponent slice) {
StringBuilder b = new StringBuilder();
boolean first = true;
@ -2709,14 +2633,6 @@ public class ProfileUtilities extends TranslatingUtilities {
return b.toString();
}
// private String describeExtension(ElementDefinition ed) {
// if (!ed.hasType() || !ed.getTypeFirstRep().hasProfile())
// return "";
// return "$"+urlTail(ed.getTypeFirstRep().getProfile());
// }
//
private String tail(String path) {
if (path.contains("."))
return path.substring(path.lastIndexOf('.')+1);
@ -2737,6 +2653,13 @@ public class ProfileUtilities extends TranslatingUtilities {
return b.toString();
}
//
//private void generateForChild(TextStreamWriter txt,
// StructureDefinition structure, ElementDefinition child) {
// // TODO Auto-generated method stub
//
//}
private String typeSummaryWithProfile(ElementDefinition ed) {
StringBuilder b = new StringBuilder();
boolean first = true;
@ -2756,13 +2679,6 @@ public class ProfileUtilities extends TranslatingUtilities {
return b.toString();
}
//
//private void generateForChild(TextStreamWriter txt,
// StructureDefinition structure, ElementDefinition child) {
// // TODO Auto-generated method stub
//
//}
private boolean unbounded(ElementDefinition definition) {
StringType max = definition.getMaxElement();
if (max == null)
@ -2773,7 +2689,7 @@ public class ProfileUtilities extends TranslatingUtilities {
return false;
return true;
}
private void updateFromBase(ElementDefinition derived, ElementDefinition base) {
if (base.hasBase()) {
if (!derived.hasBase())
@ -2801,7 +2717,7 @@ public class ProfileUtilities extends TranslatingUtilities {
// Before applying changes, apply them to what's in the profile
// TODO: follow Chris's rules
if (base.hasSliceName()) {
StructureDefinition profile = source.getType().size() == 1 && source.getTypeFirstRep().hasProfile() ? context.fetchResource(StructureDefinition.class, source.getTypeFirstRep().getProfile()) : null;
StructureDefinition profile = source.getType().size() == 1 && source.getTypeFirstRep().hasProfile() ? context.fetchResource(StructureDefinition.class, source.getTypeFirstRep().getProfile().get(0).getValue()) : null;
if (profile != null) {
ElementDefinition e = profile.getSnapshot().getElement().get(0);
base.setDefinition(e.getDefinition());
@ -2980,6 +2896,12 @@ public class ProfileUtilities extends TranslatingUtilities {
derived.setIsModifierElement(null);
else if (derived.hasIsModifierElement())
derived.getIsModifierElement().setUserData(DERIVATION_EQUALS, true);
if (derived.hasIsModifierReasonElement() && !(base.hasIsModifierReasonElement() && Base.compareDeep(derived.getIsModifierReasonElement(), base.getIsModifierReasonElement(), false)))
base.setIsModifierReasonElement(derived.getIsModifierReasonElement().copy());
else if (trimDifferential)
derived.setIsModifierReasonElement(null);
else if (derived.hasIsModifierReasonElement())
derived.getIsModifierReasonElement().setUserData(DERIVATION_EQUALS, true);
}
if (derived.hasBinding()) {
@ -2987,15 +2909,15 @@ public class ProfileUtilities extends TranslatingUtilities {
if (base.hasBinding() && base.getBinding().getStrength() == BindingStrength.REQUIRED && derived.getBinding().getStrength() != BindingStrength.REQUIRED)
messages.add(new ValidationMessage(Source.ProfileValidator, ValidationMessage.IssueType.BUSINESSRULE, pn+"."+derived.getPath(), "illegal attempt to change the binding on "+derived.getPath()+" from "+base.getBinding().getStrength().toCode()+" to "+derived.getBinding().getStrength().toCode(), ValidationMessage.IssueSeverity.ERROR));
// throw new DefinitionException("StructureDefinition "+pn+" at "+derived.getPath()+": illegal attempt to change a binding from "+base.getBinding().getStrength().toCode()+" to "+derived.getBinding().getStrength().toCode());
else if (base.hasBinding() && derived.hasBinding() && base.getBinding().getStrength() == BindingStrength.REQUIRED && base.getBinding().hasValueSetReference() && derived.getBinding().hasValueSetReference()) {
ValueSetExpansionOutcome expBase = context.expandVS(context.fetchResource(ValueSet.class, base.getBinding().getValueSetReference().getReference()), true, false);
ValueSetExpansionOutcome expDerived = context.expandVS(context.fetchResource(ValueSet.class, derived.getBinding().getValueSetReference().getReference()), true, false);
else if (base.hasBinding() && derived.hasBinding() && base.getBinding().getStrength() == BindingStrength.REQUIRED && base.getBinding().hasValueSetCanonicalType() && derived.getBinding().hasValueSetCanonicalType()) {
ValueSetExpansionOutcome expBase = context.expandVS(context.fetchResource(ValueSet.class, base.getBinding().getValueSetCanonicalType().getValue()), true, false);
ValueSetExpansionOutcome expDerived = context.expandVS(context.fetchResource(ValueSet.class, derived.getBinding().getValueSetCanonicalType().getValue()), true, false);
if (expBase.getValueset() == null)
messages.add(new ValidationMessage(Source.ProfileValidator, ValidationMessage.IssueType.BUSINESSRULE, pn+"."+base.getPath(), "Binding "+base.getBinding().getValueSetReference().getReference()+" could not be expanded", ValidationMessage.IssueSeverity.WARNING));
messages.add(new ValidationMessage(Source.ProfileValidator, ValidationMessage.IssueType.BUSINESSRULE, pn+"."+base.getPath(), "Binding "+base.getBinding().getValueSetCanonicalType().getValue()+" could not be expanded", ValidationMessage.IssueSeverity.WARNING));
else if (expDerived.getValueset() == null)
messages.add(new ValidationMessage(Source.ProfileValidator, ValidationMessage.IssueType.BUSINESSRULE, pn+"."+derived.getPath(), "Binding "+derived.getBinding().getValueSetReference().getReference()+" could not be expanded", ValidationMessage.IssueSeverity.WARNING));
messages.add(new ValidationMessage(Source.ProfileValidator, ValidationMessage.IssueType.BUSINESSRULE, pn+"."+derived.getPath(), "Binding "+derived.getBinding().getValueSetCanonicalType().getValue()+" could not be expanded", ValidationMessage.IssueSeverity.WARNING));
else if (!isSubset(expBase.getValueset(), expDerived.getValueset()))
messages.add(new ValidationMessage(Source.ProfileValidator, ValidationMessage.IssueType.BUSINESSRULE, pn+"."+derived.getPath(), "Binding "+derived.getBinding().getValueSetReference().getReference()+" is not a subset of binding "+base.getBinding().getValueSetReference().getReference(), ValidationMessage.IssueSeverity.ERROR));
messages.add(new ValidationMessage(Source.ProfileValidator, ValidationMessage.IssueType.BUSINESSRULE, pn+"."+derived.getPath(), "Binding "+derived.getBinding().getValueSetCanonicalType().getValue()+" is not a subset of binding "+base.getBinding().getValueSetCanonicalType().getValue(), ValidationMessage.IssueSeverity.ERROR));
}
base.setBinding(derived.getBinding().copy());
} else if (trimDifferential)
@ -3084,15 +3006,15 @@ public class ProfileUtilities extends TranslatingUtilities {
dest.setBinding(null);
// finally, we copy any extensions from source to dest
for (Extension ex : base.getExtension()) {
for (Extension ex : derived.getExtension()) {
StructureDefinition sd = context.fetchResource(StructureDefinition.class, ex.getUrl());
if (sd == null || sd.getSnapshot() == null || sd.getSnapshot().getElementFirstRep().getMax().equals("1"))
ToolingExtensions.removeExtension(dest, ex.getUrl());
dest.addExtension(ex);
dest.addExtension(ex.copy());
}
}
}
private void updateFromSlicing(ElementDefinitionSlicingComponent dst, ElementDefinitionSlicingComponent src) {
if (src.hasOrderedElement())
dst.setOrderedElement(src.getOrderedElement().copy());
@ -3142,16 +3064,16 @@ public class ProfileUtilities extends TranslatingUtilities {
private ElementDefinition updateURLs(String url, ElementDefinition element) {
if (element != null) {
ElementDefinition defn = element;
if (defn.hasBinding() && defn.getBinding().getValueSet() instanceof Reference && ((Reference)defn.getBinding().getValueSet()).getReference().startsWith("#"))
((Reference)defn.getBinding().getValueSet()).setReference(url+((Reference)defn.getBinding().getValueSet()).getReference());
if (defn.hasBinding() && defn.getBinding().hasValueSetCanonicalType() && defn.getBinding().getValueSet().primitiveValue().startsWith("#"))
((Reference)defn.getBinding().getValueSet()).setReference(url+defn.getBinding().getValueSet().primitiveValue());
for (TypeRefComponent t : defn.getType()) {
if (t.hasProfile()) {
if (t.getProfile().startsWith("#"))
t.setProfile(url+t.getProfile());
for (UriType u : t.getProfile()) {
if (u.getValue().startsWith("#"))
u.setValue(url+t.getProfile());
}
if (t.hasTargetProfile()) {
if (t.getTargetProfile().startsWith("#"))
t.setTargetProfile(url+t.getTargetProfile());
for (UriType u : t.getTargetProfile()) {
if (u.getValue().startsWith("#"))
u.setValue(url+t.getTargetProfile());
}
}
}
@ -3185,7 +3107,7 @@ public class ProfileUtilities extends TranslatingUtilities {
writeElements(child, list);
}
}
public static String buildR2Discriminator(ElementDefinitionSlicingDiscriminatorComponent t) throws FHIRException {
switch (t.getType()) {
case PROFILE: return t.getPath()+"/@profile";
@ -3195,20 +3117,19 @@ public class ProfileUtilities extends TranslatingUtilities {
default: throw new FHIRException("Unable to represent "+t.getType().toCode()+":"+t.getPath()+" in R2");
}
}
public static String describeExtensionContext(StructureDefinition ext) {
CommaSeparatedStringBuilder b = new CommaSeparatedStringBuilder();
for (StringType t : ext.getContext())
b.append(t.getValue());
if (!ext.hasContextType())
throw new Error("no context type on "+ext.getUrl());
switch (ext.getContextType()) {
case DATATYPE: return "Use on data type: "+b.toString();
case EXTENSION: return "Use on extension: "+b.toString();
case RESOURCE: return "Use on element: "+b.toString();
default:
return "??";
StringBuilder b = new StringBuilder();
b.append("Use on ");
for (int i = 0; i < ext.getContext().size(); i++) {
StructureDefinitionContextComponent ec = ext.getContext().get(i);
if (i > 0)
b.append(i < ext.getContext().size() - 1 ? ", " : " or ");
b.append(ec.getType().getDisplay());
b.append(" ");
b.append(ec.getExpression());
}
return b.toString();
}
/**
@ -3304,6 +3225,8 @@ public class ProfileUtilities extends TranslatingUtilities {
}
public static ElementDefinitionSlicingDiscriminatorComponent interpretR2Discriminator(String discriminator, boolean isExists) {
if (discriminator.endsWith("@pattern"))
return makeDiscriminator(DiscriminatorType.PATTERN, discriminator.length() == 8 ? "" : discriminator.substring(discriminator.length()-9));
if (discriminator.endsWith("@profile"))
return makeDiscriminator(DiscriminatorType.PROFILE, discriminator.length() == 8 ? "" : discriminator.substring(discriminator.length()-9));
if (discriminator.endsWith("@type"))
@ -3347,7 +3270,7 @@ public class ProfileUtilities extends TranslatingUtilities {
boolean prependLinks();
BindingResolution resolveBinding(StructureDefinition def, ElementDefinitionBindingComponent binding, String path);
BindingResolution resolveBinding(StructureDefinition def, ElementDefinitionBindingComponent binding, String path) throws FHIRException;
public class BindingResolution {
public String display;
@ -3405,16 +3328,6 @@ public class ProfileUtilities extends TranslatingUtilities {
private boolean used;
}
private class Slicer extends ElementDefinitionSlicingComponent {
String criteria = "";
String name = "";
boolean check;
public Slicer(boolean cantCheck) {
super();
this.check = cantCheck;
}
}
private class BaseExampleValueAccessor implements ExampleValueAccessor {
@Override
public Type getExampleValue(ElementDefinition ed) {

View File

@ -1,770 +0,0 @@
package org.hl7.fhir.r4.conformance;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.tuple.ImmutablePair;
import org.apache.commons.lang3.tuple.Pair;
import org.hl7.fhir.r4.context.IWorkerContext;
import org.hl7.fhir.r4.elementmodel.TurtleParser;
import org.hl7.fhir.r4.model.DomainResource;
import org.hl7.fhir.r4.model.ElementDefinition;
import org.hl7.fhir.r4.model.Enumerations;
import org.hl7.fhir.r4.model.Reference;
import org.hl7.fhir.r4.model.Resource;
import org.hl7.fhir.r4.model.StructureDefinition;
import org.hl7.fhir.r4.model.Type;
import org.hl7.fhir.r4.model.UriType;
import org.hl7.fhir.r4.model.ValueSet;
import org.hl7.fhir.r4.terminologies.ValueSetExpander;
import org.hl7.fhir.r4.utils.ToolingExtensions;
import org.hl7.fhir.exceptions.FHIRException;
import org.stringtemplate.v4.ST;
public class ShExGenerator {
public enum HTMLLinkPolicy {
NONE, EXTERNAL, INTERNAL
}
public boolean doDatatypes = true; // add data types
public boolean withComments = true; // include comments
public boolean completeModel = false; // doing complete build (fhir.shex)
private static String SHEX_TEMPLATE = "$header$\n\n" +
"$shapeDefinitions$";
// A header is a list of prefixes, a base declaration and a start node
private static String FHIR = "http://hl7.org/fhir/";
private static String FHIR_VS = FHIR + "ValueSet/";
private static String HEADER_TEMPLATE =
"PREFIX fhir: <$fhir$> \n" +
"PREFIX fhirvs: <$fhirvs$>\n" +
"PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> \n" +
"BASE <http://hl7.org/fhir/shape/>\n$start$";
// Start template for single (open) entry
private static String START_TEMPLATE = "\n\nstart=@<$id$> AND {fhir:nodeRole [fhir:treeRoot]}\n";
// Start template for complete (closed) model
private static String ALL_START_TEMPLATE = "\n\nstart=@<All>\n";
private static String ALL_TEMPLATE = "\n<All> $all_entries$\n";
private static String ALL_ENTRY_TEMPLATE = "(NOT { fhir:nodeRole [fhir:treeRoot] ; a [fhir:$id$] } OR @<$id$>)";
// Shape Definition
// the shape name
// an optional resource declaration (type + treeRoot)
// the list of element declarations
// an optional index element (for appearances inside ordered lists)
private static String SHAPE_DEFINITION_TEMPLATE =
"$comment$\n<$id$> CLOSED {\n $resourceDecl$" +
"\n $elements$" +
"\n fhir:index xsd:integer? # Relative position in a list\n}\n";
// Resource Definition
// an open shape of type Resource. Used when completeModel = false.
private static String RESOURCE_SHAPE_TEMPLATE =
"$comment$\n<Resource> {a .+;" +
"\n $elements$" +
"\n fhir:index xsd:integer?" +
"\n}\n";
// If we have knowledge of all of the possible resources available to us (completeModel = true), we can build
// a model of all possible resources.
private static String COMPLETE_RESOURCE_TEMPLATE =
"<Resource> @<$resources$>" +
"\n\n";
// Resource Declaration
// a type node
// an optional treeRoot declaration (identifies the entry point)
private static String RESOURCE_DECL_TEMPLATE = "\na [fhir:$id$];$root$";
// Root Declaration.
private static String ROOT_TEMPLATE = "\nfhir:nodeRole [fhir:treeRoot]?;";
// Element
// a predicate, type and cardinality triple
private static String ELEMENT_TEMPLATE = "$id$$defn$$card$$comment$";
private static int COMMENT_COL = 40;
private static int MAX_CHARS = 35;
private static int MIN_COMMENT_SEP = 2;
// Inner Shape Definition
private static String INNER_SHAPE_TEMPLATE = "($comment$\n $defn$\n)$card$";
// Simple Element
// a shape reference
private static String SIMPLE_ELEMENT_DEFN_TEMPLATE = "@<$typ$>$vsdef$";
// Value Set Element
private static String VALUESET_DEFN_TEMPLATE = " AND\n\t{fhir:value @$vsn$}";
// Fixed Value Template
private static String FIXED_VALUE_TEMPLATE = " AND\n\t{fhir:value [\"$val$\"]}";
// A primitive element definition
// the actual type reference
private static String PRIMITIVE_ELEMENT_DEFN_TEMPLATE = "$typ$$facets$";
// Facets
private static String MINVALUE_TEMPLATE = " MININCLUSIVE $val$";
private static String MAXVALUE_TEMPLATE = " MAXINCLUSIVE $val$";
private static String MAXLENGTH_TEMPLATE = " MAXLENGTH $val$";
private static String PATTERN_TEMPLATE = " PATTERN \"$val$\"";
// A choice of alternative shape definitions
// rendered as an inner anonymous shape
private static String ALTERNATIVE_SHAPES_TEMPLATE = "fhir:$id$$comment$\n( $altEntries$\n)$card$";
// A typed reference definition
private static String REFERENCE_DEFN_TEMPLATE = "@<$ref$Reference>";
// What we emit for an xhtml
private static String XHTML_TYPE_TEMPLATE = "xsd:string";
// Additional type for Coding
private static String CONCEPT_REFERENCE_TEMPLATE = "a NONLITERAL?;";
// Additional type for CodedConcept
private static String CONCEPT_REFERENCES_TEMPLATE = "a NONLITERAL*;";
// Untyped resource has the extra link entry
private static String RESOURCE_LINK_TEMPLATE = "fhir:link IRI?;";
// Extension template
// No longer used -- we emit the actual definition
// private static String EXTENSION_TEMPLATE = "<Extension> {fhir:extension @<Extension>*;" +
// "\n fhir:index xsd:integer?" +
// "\n}\n";
// A typed reference -- a fhir:uri with an optional type and the possibility of a resolvable shape
private static String TYPED_REFERENCE_TEMPLATE = "\n<$refType$Reference> CLOSED {" +
"\n fhir:Element.id @<id>?;" +
"\n fhir:Element.extension @<Extension>*;" +
"\n fhir:link @<$refType$> OR CLOSED {a [fhir:$refType$]}?;" +
"\n fhir:Reference.reference @<string>?;" +
"\n fhir:Reference.display @<string>?;" +
"\n fhir:index xsd:integer?" +
"\n}";
private static String TARGET_REFERENCE_TEMPLATE = "\n<$refType$> {" +
"\n a [fhir:$refType$];" +
"\n fhir:nodeRole [fhir:treeRoot]?" +
"\n}";
// A value set definition
private static String VALUE_SET_DEFINITION = "# $comment$\n$vsuri$$val_list$\n";
/**
* this makes internal metadata services available to the generator - retrieving structure definitions, and value set expansion etc
*/
private IWorkerContext context;
/**
* innerTypes -- inner complex types. Currently flattened in ShEx (doesn't have to be, btw)
* emittedInnerTypes -- set of inner types that have been generated
* datatypes, emittedDatatypes -- types used in the definition, types that have been generated
* references -- Reference types (Patient, Specimen, etc)
* uniq_structures -- set of structures on the to be generated list...
* doDataTypes -- whether or not to emit the data types.
*/
private HashSet<Pair<StructureDefinition, ElementDefinition>> innerTypes, emittedInnerTypes;
private HashSet<String> datatypes, emittedDatatypes;
private HashSet<String> references;
private LinkedList<StructureDefinition> uniq_structures;
private HashSet<String> uniq_structure_urls;
private HashSet<ValueSet> required_value_sets;
private HashSet<String> known_resources; // Used when generating a full definition
public ShExGenerator(IWorkerContext context) {
super();
this.context = context;
innerTypes = new HashSet<Pair<StructureDefinition, ElementDefinition>>();
emittedInnerTypes = new HashSet<Pair<StructureDefinition, ElementDefinition>>();
datatypes = new HashSet<String>();
emittedDatatypes = new HashSet<String>();
references = new HashSet<String>();
required_value_sets = new HashSet<ValueSet>();
known_resources = new HashSet<String>();
}
public String generate(HTMLLinkPolicy links, StructureDefinition structure) {
List<StructureDefinition> list = new ArrayList<StructureDefinition>();
list.add(structure);
innerTypes.clear();
emittedInnerTypes.clear();
datatypes.clear();
emittedDatatypes.clear();
references.clear();
required_value_sets.clear();
known_resources.clear();
return generate(links, list);
}
public class SortById implements Comparator<StructureDefinition> {
@Override
public int compare(StructureDefinition arg0, StructureDefinition arg1) {
return arg0.getId().compareTo(arg1.getId());
}
}
private ST tmplt(String template) {
return new ST(template, '$', '$');
}
/**
* this is called externally to generate a set of structures to a single ShEx file
* generally, it will be called with a single structure, or a long list of structures (all of them)
*
* @param links HTML link rendering policy
* @param structures list of structure definitions to render
* @return ShEx definition of structures
*/
public String generate(HTMLLinkPolicy links, List<StructureDefinition> structures) {
ST shex_def = tmplt(SHEX_TEMPLATE);
String start_cmd;
if(completeModel || structures.get(0).getKind().equals(StructureDefinition.StructureDefinitionKind.RESOURCE))
// || structures.get(0).getKind().equals(StructureDefinition.StructureDefinitionKind.COMPLEXTYPE))
start_cmd = completeModel? tmplt(ALL_START_TEMPLATE).render() :
tmplt(START_TEMPLATE).add("id", structures.get(0).getId()).render();
else
start_cmd = "";
shex_def.add("header", tmplt(HEADER_TEMPLATE).
add("start", start_cmd).
add("fhir", FHIR).
add("fhirvs", FHIR_VS).render());
Collections.sort(structures, new SortById());
StringBuilder shapeDefinitions = new StringBuilder();
// For unknown reasons, the list of structures carries duplicates. We remove them
// Also, it is possible for the same sd to have multiple hashes...
uniq_structures = new LinkedList<StructureDefinition>();
uniq_structure_urls = new HashSet<String>();
for (StructureDefinition sd : structures) {
if (!uniq_structure_urls.contains(sd.getUrl())) {
uniq_structures.add(sd);
uniq_structure_urls.add(sd.getUrl());
}
}
for (StructureDefinition sd : uniq_structures) {
shapeDefinitions.append(genShapeDefinition(sd, true));
}
shapeDefinitions.append(emitInnerTypes());
if(doDatatypes) {
shapeDefinitions.append("\n#---------------------- Data Types -------------------\n");
while (emittedDatatypes.size() < datatypes.size() ||
emittedInnerTypes.size() < innerTypes.size()) {
shapeDefinitions.append(emitDataTypes());
shapeDefinitions.append(emitInnerTypes());
}
}
shapeDefinitions.append("\n#---------------------- Reference Types -------------------\n");
for(String r: references) {
shapeDefinitions.append("\n").append(tmplt(TYPED_REFERENCE_TEMPLATE).add("refType", r).render()).append("\n");
if (!"Resource".equals(r) && !known_resources.contains(r))
shapeDefinitions.append("\n").append(tmplt(TARGET_REFERENCE_TEMPLATE).add("refType", r).render()).append("\n");
}
shex_def.add("shapeDefinitions", shapeDefinitions);
if(completeModel && known_resources.size() > 0) {
shapeDefinitions.append("\n").append(tmplt(COMPLETE_RESOURCE_TEMPLATE)
.add("resources", StringUtils.join(known_resources, "> OR\n\t@<")).render());
List<String> all_entries = new ArrayList<String>();
for(String kr: known_resources)
all_entries.add(tmplt(ALL_ENTRY_TEMPLATE).add("id", kr).render());
shapeDefinitions.append("\n").append(tmplt(ALL_TEMPLATE)
.add("all_entries", StringUtils.join(all_entries, " OR\n\t")).render());
}
shapeDefinitions.append("\n#---------------------- Value Sets ------------------------\n");
for(ValueSet vs: required_value_sets)
shapeDefinitions.append("\n").append(genValueSet(vs));
return shex_def.render();
}
/**
* Emit a ShEx definition for the supplied StructureDefinition
* @param sd Structure definition to emit
* @param top_level True means outermost type, False means recursively called
* @return ShEx definition
*/
private String genShapeDefinition(StructureDefinition sd, boolean top_level) {
// xhtml is treated as an atom
if("xhtml".equals(sd.getName()) || (completeModel && "Resource".equals(sd.getName())))
return "";
ST shape_defn;
// Resources are either incomplete items or consist of everything that is defined as a resource (completeModel)
if("Resource".equals(sd.getName())) {
shape_defn = tmplt(RESOURCE_SHAPE_TEMPLATE);
known_resources.add(sd.getName());
} else {
shape_defn = tmplt(SHAPE_DEFINITION_TEMPLATE).add("id", sd.getId());
if (sd.getKind().equals(StructureDefinition.StructureDefinitionKind.RESOURCE)) {
// || sd.getKind().equals(StructureDefinition.StructureDefinitionKind.COMPLEXTYPE)) {
known_resources.add(sd.getName());
ST resource_decl = tmplt(RESOURCE_DECL_TEMPLATE).
add("id", sd.getId()).
add("root", tmplt(ROOT_TEMPLATE));
// add("root", top_level ? tmplt(ROOT_TEMPLATE) : "");
shape_defn.add("resourceDecl", resource_decl.render());
} else {
shape_defn.add("resourceDecl", "");
}
}
// Generate the defining elements
List<String> elements = new ArrayList<String>();
// Add the additional entries for special types
String sdn = sd.getName();
if (sdn.equals("Coding"))
elements.add(tmplt(CONCEPT_REFERENCE_TEMPLATE).render());
else if (sdn.equals("CodeableConcept"))
elements.add(tmplt(CONCEPT_REFERENCES_TEMPLATE).render());
else if (sdn.equals("Reference"))
elements.add(tmplt(RESOURCE_LINK_TEMPLATE).render());
// else if (sdn.equals("Extension"))
// return tmplt(EXTENSION_TEMPLATE).render();
String root_comment = null;
for (ElementDefinition ed : sd.getSnapshot().getElement()) {
if(!ed.getPath().contains("."))
root_comment = ed.getShort();
else if (StringUtils.countMatches(ed.getPath(), ".") == 1 && !"0".equals(ed.getMax())) {
elements.add(genElementDefinition(sd, ed));
}
}
shape_defn.add("elements", StringUtils.join(elements, "\n"));
shape_defn.add("comment", root_comment == null? " " : "# " + root_comment);
return shape_defn.render();
}
/**
* Generate a flattened definition for the inner types
* @return stringified inner type definitions
*/
private String emitInnerTypes() {
StringBuilder itDefs = new StringBuilder();
while(emittedInnerTypes.size() < innerTypes.size()) {
for (Pair<StructureDefinition, ElementDefinition> it : new HashSet<Pair<StructureDefinition, ElementDefinition>>(innerTypes)) {
if (!emittedInnerTypes.contains(it)) {
itDefs.append("\n").append(genInnerTypeDef(it.getLeft(), it.getRight()));
emittedInnerTypes.add(it);
}
}
}
return itDefs.toString();
}
/**
* Generate a shape definition for the current set of datatypes
* @return stringified data type definitions
*/
private String emitDataTypes() {
StringBuilder dtDefs = new StringBuilder();
while (emittedDatatypes.size() < datatypes.size()) {
for (String dt : new HashSet<String>(datatypes)) {
if (!emittedDatatypes.contains(dt)) {
StructureDefinition sd = context.fetchResource(StructureDefinition.class,
"http://hl7.org/fhir/StructureDefinition/" + dt);
// TODO: Figure out why the line below doesn't work
// if (sd != null && !uniq_structures.contains(sd))
if(sd != null && !uniq_structure_urls.contains(sd.getUrl()))
dtDefs.append("\n").append(genShapeDefinition(sd, false));
emittedDatatypes.add(dt);
}
}
}
return dtDefs.toString();
}
private ArrayList<String> split_text(String text, int max_col) {
int pos = 0;
ArrayList<String> rval = new ArrayList<String>();
if (text.length() <= max_col) {
rval.add(text);
} else {
String[] words = text.split(" ");
int word_idx = 0;
while(word_idx < words.length) {
StringBuilder accum = new StringBuilder();
while (word_idx < words.length && accum.length() + words[word_idx].length() < max_col)
accum.append(words[word_idx++] + " ");
if (accum.length() == 0) {
accum.append(words[word_idx].substring(0, max_col - 3) + "-");
words[word_idx] = words[word_idx].substring(max_col - 3);
}
rval.add(accum.toString());
accum = new StringBuilder();
}
}
return rval;
}
private void addComment(ST tmplt, ElementDefinition ed) {
if(withComments && ed.hasShort() && !ed.getId().startsWith("Extension.")) {
int nspaces;
char[] sep;
nspaces = Math.max(COMMENT_COL - tmplt.add("comment", "#").render().indexOf('#'), MIN_COMMENT_SEP);
tmplt.remove("comment");
sep = new char[nspaces];
Arrays.fill(sep, ' ');
ArrayList<String> comment_lines = split_text(ed.getShort().replace("\n", " "), MAX_CHARS);
StringBuilder comment = new StringBuilder("# ");
char[] indent = new char[COMMENT_COL];
Arrays.fill(indent, ' ');
for(int i = 0; i < comment_lines.size();) {
comment.append(comment_lines.get(i++));
if(i < comment_lines.size())
comment.append("\n" + new String(indent) + "# ");
}
tmplt.add("comment", new String(sep) + comment.toString());
} else {
tmplt.add("comment", " ");
}
}
/**
* Generate a ShEx element definition
* @param sd Containing structure definition
* @param ed Containing element definition
* @return ShEx definition
*/
private String genElementDefinition(StructureDefinition sd, ElementDefinition ed) {
String id = ed.hasBase() ? ed.getBase().getPath() : ed.getPath();
String shortId = id.substring(id.lastIndexOf(".") + 1);
String defn;
ST element_def;
String card = ("*".equals(ed.getMax()) ? (ed.getMin() == 0 ? "*" : "+") : (ed.getMin() == 0 ? "?" : "")) + ";";
if(id.endsWith("[x]")) {
element_def = ed.getType().size() > 1? tmplt(INNER_SHAPE_TEMPLATE) : tmplt(ELEMENT_TEMPLATE);
element_def.add("id", "");
} else {
element_def = tmplt(ELEMENT_TEMPLATE);
element_def.add("id", "fhir:" + (id.charAt(0) == id.toLowerCase().charAt(0)? shortId : id) + " ");
}
List<ElementDefinition> children = ProfileUtilities.getChildList(sd, ed);
if (children.size() > 0) {
innerTypes.add(new ImmutablePair<StructureDefinition, ElementDefinition>(sd, ed));
defn = simpleElement(sd, ed, id);
} else if(id.endsWith("[x]")) {
defn = genChoiceTypes(sd, ed, id);
}
else if (ed.getType().size() == 1) {
// Single entry
defn = genTypeRef(sd, ed, id, ed.getType().get(0));
} else if (ed.getContentReference() != null) {
// Reference to another element
String ref = ed.getContentReference();
if(!ref.startsWith("#"))
throw new AssertionError("Not equipped to deal with absolute path references: " + ref);
String refPath = null;
for(ElementDefinition ed1: sd.getSnapshot().getElement()) {
if(ed1.getId() != null && ed1.getId().equals(ref.substring(1))) {
refPath = ed1.getPath();
break;
}
}
if(refPath == null)
throw new AssertionError("Reference path not found: " + ref);
// String typ = id.substring(0, id.indexOf(".") + 1) + ed.getContentReference().substring(1);
defn = simpleElement(sd, ed, refPath);
} else if(id.endsWith("[x]")) {
defn = genChoiceTypes(sd, ed, id);
} else {
// TODO: Refactoring required here
element_def = genAlternativeTypes(ed, id, shortId);
element_def.add("id", id.charAt(0) == id.toLowerCase().charAt(0)? shortId : id);
element_def.add("card", card);
addComment(element_def, ed);
return element_def.render();
}
element_def.add("defn", defn);
element_def.add("card", card);
addComment(element_def, ed);
return element_def.render();
}
/**
* Generate a type reference and optional value set definition
* @param sd Containing StructureDefinition
* @param ed Element being defined
* @param typ Element type
* @return Type definition
*/
private String simpleElement(StructureDefinition sd, ElementDefinition ed, String typ) {
String addldef = "";
ElementDefinition.ElementDefinitionBindingComponent binding = ed.getBinding();
if(binding.hasStrength() && binding.getStrength() == Enumerations.BindingStrength.REQUIRED && "code".equals(typ)) {
ValueSet vs = resolveBindingReference(sd, binding.getValueSet());
if (vs != null) {
addldef = tmplt(VALUESET_DEFN_TEMPLATE).add("vsn", vsprefix(vs.getUrl())).render();
required_value_sets.add(vs);
}
}
// TODO: check whether value sets and fixed are mutually exclusive
if(ed.hasFixed()) {
addldef = tmplt(FIXED_VALUE_TEMPLATE).add("val", ed.getFixed().primitiveValue()).render();
}
return tmplt(SIMPLE_ELEMENT_DEFN_TEMPLATE).add("typ", typ).add("vsdef", addldef).render();
}
private String vsprefix(String uri) {
if(uri.startsWith(FHIR_VS))
return "fhirvs:" + uri.replace(FHIR_VS, "");
return "<" + uri + ">";
}
/**
* Generate a type reference
* @param sd Containing structure definition
* @param ed Containing element definition
* @param id Element id
* @param typ Element type
* @return Type reference string
*/
private String genTypeRef(StructureDefinition sd, ElementDefinition ed, String id, ElementDefinition.TypeRefComponent typ) {
if(typ.hasProfile()) {
if(typ.getCode().equals("Reference"))
return genReference("", typ);
else if(ProfileUtilities.getChildList(sd, ed).size() > 0) {
// inline anonymous type - give it a name and factor it out
innerTypes.add(new ImmutablePair<StructureDefinition, ElementDefinition>(sd, ed));
return simpleElement(sd, ed, id);
}
else {
String ref = getTypeName(typ);
datatypes.add(ref);
return simpleElement(sd, ed, ref);
}
} else if (typ.getCodeElement().getExtensionsByUrl(ToolingExtensions.EXT_RDF_TYPE).size() > 0) {
String xt = null;
try {
xt = typ.getCodeElement().getExtensionString(ToolingExtensions.EXT_RDF_TYPE);
} catch (FHIRException e) {
e.printStackTrace();
}
// TODO: Remove the next line when the type of token gets switched to string
// TODO: Add a rdf-type entry for valueInteger to xsd:integer (instead of int)
ST td_entry = tmplt(PRIMITIVE_ELEMENT_DEFN_TEMPLATE).add("typ",
xt.replace("xsd:token", "xsd:string").replace("xsd:int", "xsd:integer"));
StringBuilder facets = new StringBuilder();
if(ed.hasMinValue()) {
Type mv = ed.getMinValue();
facets.append(tmplt(MINVALUE_TEMPLATE).add("val", TurtleParser.ttlLiteral(mv.primitiveValue(), mv.fhirType())).render());
}
if(ed.hasMaxValue()) {
Type mv = ed.getMaxValue();
facets.append(tmplt(MAXVALUE_TEMPLATE).add("val", TurtleParser.ttlLiteral(mv.primitiveValue(), mv.fhirType())).render());
}
if(ed.hasMaxLength()) {
int ml = ed.getMaxLength();
facets.append(tmplt(MAXLENGTH_TEMPLATE).add("val", ml).render());
}
if(ed.hasPattern()) {
Type pat = ed.getPattern();
facets.append(tmplt(PATTERN_TEMPLATE).add("val",pat.primitiveValue()).render());
}
td_entry.add("facets", facets.toString());
return td_entry.render();
} else if (typ.getCode() == null) {
ST primitive_entry = tmplt(PRIMITIVE_ELEMENT_DEFN_TEMPLATE);
primitive_entry.add("typ", "xsd:string");
return primitive_entry.render();
} else if(typ.getCode().equals("xhtml")) {
return tmplt(XHTML_TYPE_TEMPLATE).render();
} else {
datatypes.add(typ.getCode());
return simpleElement(sd, ed, typ.getCode());
}
}
/**
* Generate a set of alternative shapes
* @param ed Containing element definition
* @param id Element definition identifier
* @param shortId id to use in the actual definition
* @return ShEx list of alternative anonymous shapes separated by "OR"
*/
private ST genAlternativeTypes(ElementDefinition ed, String id, String shortId) {
ST shex_alt = tmplt(ALTERNATIVE_SHAPES_TEMPLATE);
List<String> altEntries = new ArrayList<String>();
for(ElementDefinition.TypeRefComponent typ : ed.getType()) {
altEntries.add(genAltEntry(id, typ));
}
shex_alt.add("altEntries", StringUtils.join(altEntries, " OR\n "));
return shex_alt;
}
/**
* Generate an alternative shape for a reference
* @param id reference name
* @param typ shape type
* @return ShEx equivalent
*/
private String genAltEntry(String id, ElementDefinition.TypeRefComponent typ) {
if(!typ.getCode().equals("Reference"))
throw new AssertionError("We do not handle " + typ.getCode() + " alternatives");
return genReference(id, typ);
}
/**
* Generate a list of type choices for a "name[x]" style id
* @param sd Structure containing ed
* @param ed element definition
* @param id choice identifier
* @return ShEx fragment for the set of choices
*/
private String genChoiceTypes(StructureDefinition sd, ElementDefinition ed, String id) {
List<String> choiceEntries = new ArrayList<String>();
String base = id.replace("[x]", "");
for(ElementDefinition.TypeRefComponent typ : ed.getType())
choiceEntries.add(genChoiceEntry(sd, ed, id, base, typ));
return StringUtils.join(choiceEntries, " |\n");
}
/**
* Generate an entry in a choice list
* @param base base identifier
* @param typ type/discriminant
* @return ShEx fragment for choice entry
*/
private String genChoiceEntry(StructureDefinition sd, ElementDefinition ed, String id, String base, ElementDefinition.TypeRefComponent typ) {
ST shex_choice_entry = tmplt(ELEMENT_TEMPLATE);
String ext = typ.getCode();
shex_choice_entry.add("id", "fhir:" + base+Character.toUpperCase(ext.charAt(0)) + ext.substring(1) + " ");
shex_choice_entry.add("card", "");
shex_choice_entry.add("defn", genTypeRef(sd, ed, id, typ));
shex_choice_entry.add("comment", " ");
return shex_choice_entry.render();
}
/**
* Generate a definition for a referenced element
* @param sd Containing structure definition
* @param ed Inner element
* @return ShEx representation of element reference
*/
private String genInnerTypeDef(StructureDefinition sd, ElementDefinition ed) {
String path = ed.hasBase() ? ed.getBase().getPath() : ed.getPath();;
ST element_reference = tmplt(SHAPE_DEFINITION_TEMPLATE);
element_reference.add("resourceDecl", ""); // Not a resource
element_reference.add("id", path);
String comment = ed.getShort();
element_reference.add("comment", comment == null? " " : "# " + comment);
List<String> elements = new ArrayList<String>();
for (ElementDefinition child: ProfileUtilities.getChildList(sd, path, null))
elements.add(genElementDefinition(sd, child));
element_reference.add("elements", StringUtils.join(elements, "\n"));
return element_reference.render();
}
/**
* Generate a reference to a resource
* @param id attribute identifier
* @param typ possible reference types
* @return string that represents the result
*/
private String genReference(String id, ElementDefinition.TypeRefComponent typ) {
ST shex_ref = tmplt(REFERENCE_DEFN_TEMPLATE);
String ref = getTypeName(typ);
shex_ref.add("id", id);
shex_ref.add("ref", ref);
references.add(ref);
return shex_ref.render();
}
/**
* Return the type name for typ
* @param typ type to get name for
* @return name
*/
private String getTypeName(ElementDefinition.TypeRefComponent typ) {
// TODO: This is brittle. There has to be a utility to do this...
if (typ.hasTargetProfile()) {
String[] els = typ.getTargetProfile().split("/");
return els[els.length - 1];
} else if (typ.hasProfile()) {
String[] els = typ.getProfile().split("/");
return els[els.length - 1];
} else {
return typ.getCode();
}
}
private String genValueSet(ValueSet vs) {
ST vsd = tmplt(VALUE_SET_DEFINITION).add("vsuri", vsprefix(vs.getUrl())).add("comment", vs.getDescription());
ValueSetExpander.ValueSetExpansionOutcome vse = context.expandVS(vs, true, false);
List<String> valid_codes = new ArrayList<String>();
if(vse != null &&
vse.getValueset() != null &&
vse.getValueset().hasExpansion() &&
vse.getValueset().getExpansion().hasContains()) {
for(ValueSet.ValueSetExpansionContainsComponent vsec : vse.getValueset().getExpansion().getContains())
valid_codes.add("\"" + vsec.getCode() + "\"");
}
return vsd.add("val_list", valid_codes.size() > 0? " [" + StringUtils.join(valid_codes, " ") + ']' : " EXTERNAL").render();
}
// TODO: find a utility that implements this
private ValueSet resolveBindingReference(DomainResource ctxt, Type reference) {
if (reference instanceof UriType) {
return context.fetchResource(ValueSet.class, ((UriType) reference).getValue().toString());
}
else if (reference instanceof Reference) {
String s = ((Reference) reference).getReference();
if (s.startsWith("#")) {
for (Resource c : ctxt.getContained()) {
if (c.getId().equals(s.substring(1)) && (c instanceof ValueSet))
return (ValueSet) c;
}
return null;
} else {
return context.fetchResource(ValueSet.class, ((Reference) reference).getReference());
}
}
else
return null;
}
}

View File

@ -19,6 +19,7 @@ import org.apache.commons.lang3.StringUtils;
import org.hl7.fhir.r4.formats.IParser.OutputStyle;
import org.hl7.fhir.r4.conformance.ProfileUtilities;
import org.hl7.fhir.r4.context.BaseWorkerContext.NullTranslator;
import org.hl7.fhir.r4.context.IWorkerContext.ValidationResult;
import org.hl7.fhir.r4.context.IWorkerContext.ILoggingService.LogCategory;
import org.hl7.fhir.r4.formats.JsonParser;
import org.hl7.fhir.r4.model.BooleanType;
@ -30,6 +31,8 @@ import org.hl7.fhir.r4.model.CodeSystem.CodeSystemHierarchyMeaning;
import org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionComponent;
import org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionDesignationComponent;
import org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionBindingComponent;
import org.hl7.fhir.r4.model.NamingSystem.NamingSystemIdentifierType;
import org.hl7.fhir.r4.model.NamingSystem.NamingSystemUniqueIdComponent;
import org.hl7.fhir.r4.model.CodeableConcept;
import org.hl7.fhir.r4.model.Coding;
import org.hl7.fhir.r4.model.ConceptMap;
@ -68,6 +71,7 @@ import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.exceptions.NoTerminologyServiceException;
import org.hl7.fhir.exceptions.TerminologyServiceException;
import org.hl7.fhir.utilities.CommaSeparatedStringBuilder;
import org.hl7.fhir.utilities.OIDUtils;
import org.hl7.fhir.utilities.TextFile;
import org.hl7.fhir.utilities.TranslationServices;
import org.hl7.fhir.utilities.Utilities;
@ -76,27 +80,32 @@ import org.hl7.fhir.utilities.validation.ValidationMessage.IssueSeverity;
import org.hl7.fhir.utilities.validation.ValidationMessage.IssueType;
import org.hl7.fhir.utilities.validation.ValidationMessage.Source;
import com.google.gson.JsonObject;
import com.google.gson.JsonSyntaxException;
import ca.uhn.fhir.rest.annotation.Metadata;
public abstract class BaseWorkerContext implements IWorkerContext {
protected Map<String, Map<String, Resource>> allResourcesById = new HashMap<String, Map<String, Resource>>();
private Object lock = new Object(); // used as a lock for the data that follows
private Map<String, Map<String, Resource>> allResourcesById = new HashMap<String, Map<String, Resource>>();
// all maps are to the full URI
protected Map<String, CodeSystem> codeSystems = new HashMap<String, CodeSystem>();
protected Set<String> nonSupportedCodeSystems = new HashSet<String>();
protected Map<String, ValueSet> valueSets = new HashMap<String, ValueSet>();
protected Map<String, ConceptMap> maps = new HashMap<String, ConceptMap>();
protected Map<String, StructureMap> transforms = new HashMap<String, StructureMap>();
private Map<String, CodeSystem> codeSystems = new HashMap<String, CodeSystem>();
private Set<String> nonSupportedCodeSystems = new HashSet<String>();
private Map<String, ValueSet> valueSets = new HashMap<String, ValueSet>();
private Map<String, ConceptMap> maps = new HashMap<String, ConceptMap>();
private Map<String, StructureMap> transforms = new HashMap<String, StructureMap>();
// private Map<String, StructureDefinition> profiles = new HashMap<String, StructureDefinition>();
protected Map<String, StructureDefinition> structures = new HashMap<String, StructureDefinition>();
private Map<String, StructureDefinition> structures = new HashMap<String, StructureDefinition>();
// private Map<String, StructureDefinition> extensionDefinitions = new HashMap<String, StructureDefinition>();
protected Map<String, SearchParameter> searchParameters = new HashMap<String, SearchParameter>();
protected Map<String, Questionnaire> questionnaires = new HashMap<String, Questionnaire>();
protected Map<String, OperationDefinition> operations = new HashMap<String, OperationDefinition>();
protected List<NamingSystem> systems = new ArrayList<NamingSystem>();
private Map<String, SearchParameter> searchParameters = new HashMap<String, SearchParameter>();
private Map<String, Questionnaire> questionnaires = new HashMap<String, Questionnaire>();
private Map<String, OperationDefinition> operations = new HashMap<String, OperationDefinition>();
private List<NamingSystem> systems = new ArrayList<NamingSystem>();
protected ValueSetExpanderFactory expansionCache = new ValueSetExpansionCache(this);
private ValueSetExpansionCache expansionCache = new ValueSetExpansionCache(this);
protected boolean cacheValidation; // if true, do an expansion and cache the expansion
private Set<String> failed = new HashSet<String>(); // value sets for which we don't try to do expansion, since the first attempt to get a comprehensive expansion was not successful
protected Map<String, Map<String, ValidationResult>> validationCache = new HashMap<String, Map<String,ValidationResult>>();
@ -117,64 +126,82 @@ public abstract class BaseWorkerContext implements IWorkerContext {
protected ExpansionProfile expProfile;
private TranslationServices translator = new NullTranslator();
protected void copy(BaseWorkerContext other) {
allResourcesById.putAll(other.allResourcesById);
translator = other.translator;
codeSystems.putAll(other.codeSystems);
nonSupportedCodeSystems.addAll(other.nonSupportedCodeSystems);
valueSets.putAll(other.valueSets);
maps.putAll(other.maps);
transforms.putAll(other.transforms);
structures.putAll(other.structures);
searchParameters.putAll(other.searchParameters);
questionnaires.putAll(other.questionnaires);
operations.putAll(other.operations);
systems.addAll(other.systems);
public BaseWorkerContext() {
super();
}
allowLoadingDuplicates = other.allowLoadingDuplicates;
cacheValidation = other.cacheValidation;
tsServer = other.tsServer;
validationCachePath = other.validationCachePath;
name = other.name;
txServer = other.txServer;
bndCodeSystems = other.bndCodeSystems;
canRunWithoutTerminology = other.canRunWithoutTerminology;
noTerminologyServer = other.noTerminologyServer;
cache = other.cache;
expandCodesLimit = other.expandCodesLimit;
logger = other.logger;
expProfile = other.expProfile;
public BaseWorkerContext(Map<String, CodeSystem> codeSystems, Map<String, ValueSet> valueSets, Map<String, ConceptMap> maps, Map<String, StructureDefinition> profiles) {
super();
this.codeSystems = codeSystems;
this.valueSets = valueSets;
this.maps = maps;
this.structures = profiles;
}
protected void copy(BaseWorkerContext other) {
synchronized (other.lock) { // tricky, because you need to lock this as well, but it's really not in use yet
allResourcesById.putAll(other.allResourcesById);
translator = other.translator;
codeSystems.putAll(other.codeSystems);
nonSupportedCodeSystems.addAll(other.nonSupportedCodeSystems);
valueSets.putAll(other.valueSets);
maps.putAll(other.maps);
transforms.putAll(other.transforms);
structures.putAll(other.structures);
searchParameters.putAll(other.searchParameters);
questionnaires.putAll(other.questionnaires);
operations.putAll(other.operations);
systems.addAll(other.systems);
allowLoadingDuplicates = other.allowLoadingDuplicates;
cacheValidation = other.cacheValidation;
tsServer = other.tsServer;
validationCachePath = other.validationCachePath;
name = other.name;
txServer = other.txServer;
bndCodeSystems = other.bndCodeSystems;
canRunWithoutTerminology = other.canRunWithoutTerminology;
noTerminologyServer = other.noTerminologyServer;
cache = other.cache;
expandCodesLimit = other.expandCodesLimit;
logger = other.logger;
expProfile = other.expProfile;
}
}
public void cacheResource(Resource r) throws FHIRException {
Map<String, Resource> map = allResourcesById.get(r.fhirType());
if (map == null) {
map = new HashMap<String, Resource>();
allResourcesById.put(r.fhirType(), map);
}
map.put(r.getId(), r);
if (r instanceof MetadataResource) {
MetadataResource m = (MetadataResource) r;
String url = m.getUrl();
if (!allowLoadingDuplicates && hasResource(r.getClass(), url))
throw new DefinitionException("Duplicate Resource " + url);
if (r instanceof StructureDefinition)
seeMetadataResource(m, structures, false);
else if (r instanceof ValueSet)
seeMetadataResource(m, valueSets, false);
else if (r instanceof CodeSystem)
seeMetadataResource(m, codeSystems, false);
else if (r instanceof OperationDefinition)
seeMetadataResource(m, operations, false);
else if (r instanceof Questionnaire)
seeMetadataResource(m, questionnaires, true);
else if (r instanceof ConceptMap)
seeMetadataResource(m, maps, false);
else if (r instanceof StructureMap)
seeMetadataResource(m, transforms, false);
else if (r instanceof NamingSystem)
systems.add((NamingSystem) r);
synchronized (lock) {
Map<String, Resource> map = allResourcesById.get(r.fhirType());
if (map == null) {
map = new HashMap<String, Resource>();
allResourcesById.put(r.fhirType(), map);
}
map.put(r.getId(), r);
if (r instanceof MetadataResource) {
MetadataResource m = (MetadataResource) r;
String url = m.getUrl();
if (!allowLoadingDuplicates && hasResource(r.getClass(), url))
throw new DefinitionException("Duplicate Resource " + url);
if (r instanceof StructureDefinition)
seeMetadataResource((StructureDefinition) m, structures, false);
else if (r instanceof ValueSet)
seeMetadataResource((ValueSet) m, valueSets, false);
else if (r instanceof CodeSystem)
seeMetadataResource((CodeSystem) m, codeSystems, false);
else if (r instanceof SearchParameter)
seeMetadataResource((SearchParameter) m, searchParameters, false);
else if (r instanceof OperationDefinition)
seeMetadataResource((OperationDefinition) m, operations, false);
else if (r instanceof Questionnaire)
seeMetadataResource((Questionnaire) m, questionnaires, true);
else if (r instanceof ConceptMap)
seeMetadataResource((ConceptMap) m, maps, false);
else if (r instanceof StructureMap)
seeMetadataResource((StructureMap) m, transforms, false);
else if (r instanceof NamingSystem)
systems.add((NamingSystem) r);
}
}
}
@ -225,7 +252,7 @@ public abstract class BaseWorkerContext implements IWorkerContext {
throw new Error("delimited versions have exact match");
}
protected void seeMetadataResource(MetadataResource r, Map map, boolean addId) throws FHIRException {
protected <T extends MetadataResource> void seeMetadataResource(T r, Map<String, T> map, boolean addId) throws FHIRException {
if (addId)
map.put(r.getId(), r); // todo: why?
if (!map.containsKey(r.getUrl()))
@ -249,47 +276,51 @@ public abstract class BaseWorkerContext implements IWorkerContext {
@Override
public CodeSystem fetchCodeSystem(String system) {
return codeSystems.get(system);
synchronized (lock) {
return codeSystems.get(system);
}
}
@Override
public boolean supportsSystem(String system) throws TerminologyServiceException {
if (codeSystems.containsKey(system))
return true;
else if (nonSupportedCodeSystems.contains(system))
return false;
else if (system.startsWith("http://example.org") || system.startsWith("http://acme.com") || system.startsWith("http://hl7.org/fhir/valueset-") || system.startsWith("urn:oid:"))
return false;
else {
if (noTerminologyServer)
return false;
if (bndCodeSystems == null) {
try {
tlog("Terminology server: Check for supported code systems for "+system);
bndCodeSystems = txServer.fetchFeed(txServer.getAddress()+"/CodeSystem?content-mode=not-present&_summary=true&_count=1000");
} catch (Exception e) {
if (canRunWithoutTerminology) {
noTerminologyServer = true;
log("==============!! Running without terminology server !!==============");
log("Error: "+e.getMessage());
return false;
} else
throw new TerminologyServiceException(e);
}
}
if (bndCodeSystems != null) {
for (BundleEntryComponent be : bndCodeSystems.getEntry()) {
CodeSystem cs = (CodeSystem) be.getResource();
if (!codeSystems.containsKey(cs.getUrl())) {
codeSystems.put(cs.getUrl(), null);
}
}
}
synchronized (lock) {
if (codeSystems.containsKey(system))
return true;
else if (nonSupportedCodeSystems.contains(system))
return false;
else if (system.startsWith("http://example.org") || system.startsWith("http://acme.com") || system.startsWith("http://hl7.org/fhir/valueset-") || system.startsWith("urn:oid:"))
return false;
else {
if (noTerminologyServer)
return false;
if (bndCodeSystems == null) {
try {
tlog("Terminology server: Check for supported code systems for "+system);
bndCodeSystems = txServer.fetchFeed(txServer.getAddress()+"/CodeSystem?content-mode=not-present&_summary=true&_count=1000");
} catch (Exception e) {
if (canRunWithoutTerminology) {
noTerminologyServer = true;
log("==============!! Running without terminology server !!============== ("+e.getMessage()+")");
log("Error: "+e.getMessage());
return false;
} else
throw new TerminologyServiceException(e);
}
}
if (bndCodeSystems != null) {
for (BundleEntryComponent be : bndCodeSystems.getEntry()) {
CodeSystem cs = (CodeSystem) be.getResource();
if (!codeSystems.containsKey(cs.getUrl())) {
codeSystems.put(cs.getUrl(), null);
}
}
}
if (codeSystems.containsKey(system))
return true;
}
nonSupportedCodeSystems.add(system);
return false;
}
nonSupportedCodeSystems.add(system);
return false;
}
private void log(String message) {
@ -693,8 +724,13 @@ public abstract class BaseWorkerContext implements IWorkerContext {
@Override
public ValidationResult validateCode(String system, String code, String display) {
try {
if (codeSystems.containsKey(system) && codeSystems.get(system) != null && codeSystems.get(system).getContent() == CodeSystemContentMode.COMPLETE)
return verifyCodeInCodeSystem(codeSystems.get(system), system, code, display);
CodeSystem cs = null;
synchronized (lock) {
cs = codeSystems.get(system);
}
if (cs != null && cs.getContent() == CodeSystemContentMode.COMPLETE)
return verifyCodeInCodeSystem(cs, system, code, display);
else
return verifyCodeExternal(null, new Coding().setSystem(system).setCode(code).setDisplay(display), false);
} catch (Exception e) {
@ -705,9 +741,13 @@ public abstract class BaseWorkerContext implements IWorkerContext {
@Override
public ValidationResult validateCode(Coding code, ValueSet vs) {
if (codeSystems.containsKey(code.getSystem()) && codeSystems.get(code.getSystem()) != null)
CodeSystem cs = null;
synchronized (lock) {
cs = codeSystems.get(code.getSystem());
}
if (cs != null)
try {
return verifyCodeInCodeSystem(codeSystems.get(code.getSystem()), code.getSystem(), code.getCode(), code.getDisplay());
return verifyCodeInCodeSystem(cs, code.getSystem(), code.getCode(), code.getDisplay());
} catch (Exception e) {
return new ValidationResult(IssueSeverity.FATAL, "Error validating code \""+code+"\" in system \""+code.getSystem()+"\": "+e.getMessage());
}
@ -757,7 +797,12 @@ public abstract class BaseWorkerContext implements IWorkerContext {
try {
if (system == null && display == null)
return verifyCodeInternal(vs, code);
if ((codeSystems.containsKey(system) && codeSystems.get(system) != null) || vs.hasExpansion())
CodeSystem cs = null;
synchronized (lock) {
cs = codeSystems.get(system);
}
if (cs != null || vs.hasExpansion())
return verifyCodeInternal(vs, system, code, display);
else
return verifyCodeExternal(vs, new Coding().setSystem(system).setCode(code).setDisplay(display), true);
@ -793,12 +838,14 @@ public abstract class BaseWorkerContext implements IWorkerContext {
}
@Override
public List<ConceptMap> findMapsForSource(String url) {
List<ConceptMap> res = new ArrayList<ConceptMap>();
for (ConceptMap map : maps.values())
if (((Reference) map.getSource()).getReference().equals(url))
res.add(map);
return res;
public List<ConceptMap> findMapsForSource(String url) throws FHIRException {
synchronized (lock) {
List<ConceptMap> res = new ArrayList<ConceptMap>();
for (ConceptMap map : maps.values())
if (((Reference) map.getSource()).getReference().equals(url))
res.add(map);
return res;
}
}
private ValidationResult verifyCodeInternal(ValueSet vs, CodeableConcept code) throws Exception {
@ -913,10 +960,6 @@ public abstract class BaseWorkerContext implements IWorkerContext {
return null;
}
public Set<String> getNonSupportedCodeSystems() {
return nonSupportedCodeSystems;
}
public boolean isCanRunWithoutTerminology() {
return canRunWithoutTerminology;
}
@ -977,72 +1020,99 @@ public abstract class BaseWorkerContext implements IWorkerContext {
@Override
public <T extends Resource> T fetchResourceWithException(Class<T> class_, String uri) throws FHIRException {
if (class_ == null) {
// it might be a special URL.
if (Utilities.isAbsoluteUrl(uri) || uri.startsWith("ValueSet/")) {
Resource res = findTxValueSet(uri);
if (res != null)
return (T) res;
}
return null;
}
if (class_ == StructureDefinition.class && !uri.contains("/"))
uri = "http://hl7.org/fhir/StructureDefinition/"+uri;
if (uri.startsWith("http:") || uri.startsWith("https:")) {
String version = null;
if (uri.contains("#"))
uri = uri.substring(0, uri.indexOf("#"));
if (class_ == Resource.class) {
if (structures.containsKey(uri))
synchronized (lock) {
if (uri.startsWith("http:") || uri.startsWith("https:")) {
String version = null;
if (uri.contains("#"))
uri = uri.substring(0, uri.indexOf("#"));
if (class_ == Resource.class) {
if (structures.containsKey(uri))
return (T) structures.get(uri);
if (valueSets.containsKey(uri))
return (T) valueSets.get(uri);
if (codeSystems.containsKey(uri))
return (T) codeSystems.get(uri);
if (operations.containsKey(uri))
return (T) operations.get(uri);
if (searchParameters.containsKey(uri))
return (T) searchParameters.get(uri);
if (maps.containsKey(uri))
return (T) maps.get(uri);
if (transforms.containsKey(uri))
return (T) transforms.get(uri);
return null;
} else if (class_ == StructureDefinition.class) {
return (T) structures.get(uri);
if (valueSets.containsKey(uri))
} else if (class_ == ValueSet.class) {
return (T) valueSets.get(uri);
if (codeSystems.containsKey(uri))
} else if (class_ == CodeSystem.class) {
return (T) codeSystems.get(uri);
if (operations.containsKey(uri))
return (T) operations.get(uri);
if (searchParameters.containsKey(uri))
return (T) searchParameters.get(uri);
if (maps.containsKey(uri))
return (T) maps.get(uri);
if (transforms.containsKey(uri))
return (T) transforms.get(uri);
return null;
} else if (class_ == StructureDefinition.class) {
return (T) structures.get(uri);
} else if (class_ == ValueSet.class) {
return (T) valueSets.get(uri);
} else if (class_ == CodeSystem.class) {
return (T) codeSystems.get(uri);
} else if (class_ == OperationDefinition.class) {
OperationDefinition od = operations.get(uri);
return (T) od;
} else if (class_ == SearchParameter.class) {
SearchParameter res = searchParameters.get(uri);
if (res == null) {
StringBuilder b = new StringBuilder();
for (String s : searchParameters.keySet()) {
b.append(s);
b.append("\r\n");
} else if (class_ == OperationDefinition.class) {
OperationDefinition od = operations.get(uri);
return (T) od;
} else if (class_ == SearchParameter.class) {
SearchParameter res = searchParameters.get(uri);
if (res == null) {
StringBuilder b = new StringBuilder();
for (String s : searchParameters.keySet()) {
b.append(s);
b.append("\r\n");
}
}
return (T) res;
}
return (T) res;
}
if (class_ == Questionnaire.class)
return null;
throw new FHIRException("not done yet: can't fetch "+uri);
}
if (class_ == Questionnaire.class)
}
private MetadataResource findTxValueSet(String uri) {
MetadataResource res = expansionCache.getStoredResource(uri);
if (res != null)
return res;
try {
res = txServer.getCanonical(ValueSet.class, uri);
} catch (Exception e) {
return null;
throw new FHIRException("not done yet: can't fetch "+uri);
}
if (res != null)
try {
expansionCache.storeResource(res);
} catch (IOException e) {
}
return res;
}
@Override
public Resource fetchResourceById(String type, String uri) {
String[] parts = uri.split("\\/");
if (!Utilities.noString(type) && parts.length == 1)
return allResourcesById.get(type).get(parts[0]);
if (parts.length >= 2) {
if (!Utilities.noString(type))
if (!type.equals(parts[parts.length-2]))
throw new Error("Resource type mismatch for "+type+" / "+uri);
return allResourcesById.get(parts[parts.length-2]).get(parts[parts.length-1]);
} else
throw new Error("Unable to process request for resource for "+type+" / "+uri);
synchronized (lock) {
String[] parts = uri.split("\\/");
if (!Utilities.noString(type) && parts.length == 1)
return allResourcesById.get(type).get(parts[0]);
if (parts.length >= 2) {
if (!Utilities.noString(type))
if (!type.equals(parts[parts.length-2]))
throw new Error("Resource type mismatch for "+type+" / "+uri);
return allResourcesById.get(parts[parts.length-2]).get(parts[parts.length-1]);
} else
throw new Error("Unable to process request for resource for "+type+" / "+uri);
}
}
public <T extends Resource> T fetchResource(Class<T> class_, String uri) {
@ -1065,10 +1135,10 @@ public abstract class BaseWorkerContext implements IWorkerContext {
@Override
public ValueSetExpansionOutcome expandVS(ElementDefinitionBindingComponent binding, boolean cacheOk, boolean heirarchical) throws FHIRException {
ValueSet vs = null;
if (binding.hasValueSetReference()) {
vs = fetchResource(ValueSet.class, binding.getValueSetReference().getReference());
if (binding.hasValueSetCanonicalType()) {
vs = fetchResource(ValueSet.class, binding.getValueSetCanonicalType().getValue());
if (vs == null)
throw new FHIRException("Unable to resolve value Set "+binding.getValueSetReference().getReference());
throw new FHIRException("Unable to resolve value Set "+binding.getValueSetCanonicalType().getValue());
} else {
vs = fetchResource(ValueSet.class, binding.getValueSetUriType().asStringValue());
if (vs == null)
@ -1127,4 +1197,188 @@ public abstract class BaseWorkerContext implements IWorkerContext {
}
public void reportStatus(JsonObject json) {
synchronized (lock) {
json.addProperty("codeystem-count", codeSystems.size());
json.addProperty("valueset-count", valueSets.size());
json.addProperty("conceptmap-count", maps.size());
json.addProperty("transforms-count", transforms.size());
json.addProperty("structures-count", structures.size());
}
}
public void dropResource(Resource r) throws FHIRException {
dropResource(r.fhirType(), r.getId());
}
public void dropResource(String fhirType, String id) {
synchronized (lock) {
Map<String, Resource> map = allResourcesById.get(fhirType);
if (map == null) {
map = new HashMap<String, Resource>();
allResourcesById.put(fhirType, map);
}
if (map.containsKey(id))
map.remove(id);
if (fhirType.equals("StructureDefinition"))
dropMetadataResource(structures, id);
else if (fhirType.equals("ValueSet"))
dropMetadataResource(valueSets, id);
else if (fhirType.equals("CodeSystem"))
dropMetadataResource(codeSystems, id);
else if (fhirType.equals("OperationDefinition"))
dropMetadataResource(operations, id);
else if (fhirType.equals("Questionnaire"))
dropMetadataResource(questionnaires, id);
else if (fhirType.equals("ConceptMap"))
dropMetadataResource(maps, id);
else if (fhirType.equals("StructureMap"))
dropMetadataResource(transforms, id);
else if (fhirType.equals("NamingSystem"))
for (int i = systems.size()-1; i >= 0; i--) {
if (systems.get(i).getId().equals(id))
systems.remove(i);
}
}
}
private <T extends MetadataResource> void dropMetadataResource(Map<String, T> map, String id) {
T res = map.get(id);
if (res != null) {
map.remove(id);
if (map.containsKey(res.getUrl()))
map.remove(res.getUrl());
if (res.getVersion() != null)
if (map.containsKey(res.getUrl()+"|"+res.getVersion()))
map.remove(res.getUrl()+"|"+res.getVersion());
}
}
@Override
public List<MetadataResource> allConformanceResources() {
synchronized (lock) {
List<MetadataResource> result = new ArrayList<MetadataResource>();
result.addAll(structures.values());
result.addAll(codeSystems.values());
result.addAll(valueSets.values());
result.addAll(maps.values());
result.addAll(transforms.values());
return result;
}
}
public void addNonSupportedCodeSystems(String s) {
synchronized (lock) {
nonSupportedCodeSystems.add(s);
}
}
public String listNonSupportedSystems() {
synchronized (lock) {
String sl = null;
for (String s : nonSupportedCodeSystems)
sl = sl == null ? s : sl + "\r\n" + s;
return sl;
}
}
public int totalCount() {
synchronized (lock) {
return valueSets.size() + maps.size() + structures.size() + transforms.size();
}
}
public List<ConceptMap> listMaps() {
List<ConceptMap> m = new ArrayList<ConceptMap>();
synchronized (lock) {
m.addAll(maps.values());
}
return m;
}
public List<StructureMap> listTransforms() {
List<StructureMap> m = new ArrayList<StructureMap>();
synchronized (lock) {
m.addAll(transforms.values());
}
return m;
}
public StructureMap getTransform(String code) {
synchronized (lock) {
return transforms.get(code);
}
}
public List<StructureDefinition> listStructures() {
List<StructureDefinition> m = new ArrayList<StructureDefinition>();
synchronized (lock) {
m.addAll(structures.values());
}
return m;
}
public StructureDefinition getStructure(String code) {
synchronized (lock) {
return structures.get(code);
}
}
public void setCache(ValueSetExpansionCache cache) {
synchronized (lock) {
this.expansionCache = cache;
}
}
@Override
public String oid2Uri(String oid) {
synchronized (lock) {
String uri = OIDUtils.getUriForOid(oid);
if (uri != null)
return uri;
for (NamingSystem ns : systems) {
if (hasOid(ns, oid)) {
uri = getUri(ns);
if (uri != null)
return null;
}
}
}
return null;
}
private String getUri(NamingSystem ns) {
for (NamingSystemUniqueIdComponent id : ns.getUniqueId()) {
if (id.getType() == NamingSystemIdentifierType.URI)
return id.getValue();
}
return null;
}
private boolean hasOid(NamingSystem ns, String oid) {
for (NamingSystemUniqueIdComponent id : ns.getUniqueId()) {
if (id.getType() == NamingSystemIdentifierType.OID && id.getValue().equals(oid))
return true;
}
return false;
}
public void cacheVS(JsonObject json, Map<String, ValidationResult> t) {
synchronized (lock) {
validationCache.put(json.get("url").getAsString(), t);
}
}
public SearchParameter getSearchParameter(String code) {
synchronized (lock) {
return searchParameters.get(code);
}
}
}

View File

@ -15,6 +15,7 @@ import org.hl7.fhir.r4.model.ExpansionProfile;
import org.hl7.fhir.r4.model.MetadataResource;
import org.hl7.fhir.r4.model.Resource;
import org.hl7.fhir.r4.model.StructureDefinition;
import org.hl7.fhir.r4.model.StructureMap;
import org.hl7.fhir.r4.model.ValueSet;
import org.hl7.fhir.r4.model.ValueSet.ConceptSetComponent;
import org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionComponent;
@ -222,8 +223,9 @@ public interface IWorkerContext {
* find concept maps for a source
* @param url
* @return
* @throws FHIRException
*/
public List<ConceptMap> findMapsForSource(String url);
public List<ConceptMap> findMapsForSource(String url) throws FHIRException;
/**
* ValueSet Expansion - see $expand
@ -389,4 +391,6 @@ public interface IWorkerContext {
public boolean isNoTerminologyServer();
public TranslationServices translator();
public List<StructureMap> listTransforms();
public StructureMap getTransform(String url);
}

View File

@ -64,6 +64,8 @@ import org.hl7.fhir.utilities.validation.ValidationMessage;
import org.hl7.fhir.utilities.validation.ValidationMessage.IssueType;
import org.hl7.fhir.utilities.validation.ValidationMessage.Source;
import com.google.gson.JsonObject;
import ca.uhn.fhir.parser.DataFormatException;
/*
@ -100,7 +102,6 @@ public class SimpleWorkerContext extends BaseWorkerContext implements IWorkerCon
protected void copy(SimpleWorkerContext other) {
super.copy(other);
systems.addAll(other.systems);
questionnaire = other.questionnaire;
binaries.putAll(other.binaries);
version = other.version;
@ -323,18 +324,11 @@ public class SimpleWorkerContext extends BaseWorkerContext implements IWorkerCon
public int totalCount() {
return valueSets.size() + maps.size() + structures.size() + transforms.size();
}
public void setCache(ValueSetExpansionCache cache) {
this.expansionCache = cache;
}
@Override
public List<String> getResourceNames() {
List<String> result = new ArrayList<String>();
for (StructureDefinition sd : structures.values()) {
for (StructureDefinition sd : listStructures()) {
if (sd.getKind() == StructureDefinitionKind.RESOURCE && sd.getDerivation() == TypeDerivationRule.SPECIALIZATION)
result.add(sd.getName());
}
@ -345,7 +339,7 @@ public class SimpleWorkerContext extends BaseWorkerContext implements IWorkerCon
@Override
public List<String> getTypeNames() {
List<String> result = new ArrayList<String>();
for (StructureDefinition sd : structures.values()) {
for (StructureDefinition sd : listStructures()) {
if (sd.getKind() != StructureDefinitionKind.LOGICAL && sd.getDerivation() == TypeDerivationRule.SPECIALIZATION)
result.add(sd.getName());
}
@ -409,14 +403,14 @@ public class SimpleWorkerContext extends BaseWorkerContext implements IWorkerCon
@Override
public Set<String> typeTails() {
return new HashSet<String>(Arrays.asList("Integer","UnsignedInt","PositiveInt","Decimal","DateTime","Date","Time","Instant","String","Uri","Oid","Uuid","Id","Boolean","Code","Markdown","Base64Binary","Coding","CodeableConcept","Attachment","Identifier","Quantity","SampledData","Range","Period","Ratio","HumanName","Address","ContactPoint","Timing","Reference","Annotation","Signature","Meta"));
return new HashSet<String>(Arrays.asList("Integer","UnsignedInt","PositiveInt","Decimal","DateTime","Date","Time","Instant","String","Uri","Url","Canonical","Oid","Uuid","Id","Boolean","Code","Markdown","Base64Binary","Coding","CodeableConcept","Attachment","Identifier","Quantity","SampledData","Range","Period","Ratio","HumanName","Address","ContactPoint","Timing","Reference","Annotation","Signature","Meta"));
}
@Override
public List<StructureDefinition> allStructures() {
List<StructureDefinition> result = new ArrayList<StructureDefinition>();
Set<StructureDefinition> set = new HashSet<StructureDefinition>();
for (StructureDefinition sd : structures.values()) {
for (StructureDefinition sd : listStructures()) {
if (!set.contains(sd)) {
result.add(sd);
set.add(sd);
@ -425,51 +419,6 @@ public class SimpleWorkerContext extends BaseWorkerContext implements IWorkerCon
return result;
}
@Override
public List<MetadataResource> allConformanceResources() {
List<MetadataResource> result = new ArrayList<MetadataResource>();
result.addAll(structures.values());
result.addAll(codeSystems.values());
result.addAll(valueSets.values());
result.addAll(maps.values());
result.addAll(transforms.values());
return result;
}
@Override
public String oid2Uri(String oid) {
String uri = OIDUtils.getUriForOid(oid);
if (uri != null)
return uri;
for (NamingSystem ns : systems) {
if (hasOid(ns, oid)) {
uri = getUri(ns);
if (uri != null)
return null;
}
}
return null;
}
private String getUri(NamingSystem ns) {
for (NamingSystemUniqueIdComponent id : ns.getUniqueId()) {
if (id.getType() == NamingSystemIdentifierType.URI)
return id.getValue();
}
return null;
}
private boolean hasOid(NamingSystem ns, String oid) {
for (NamingSystemUniqueIdComponent id : ns.getUniqueId()) {
if (id.getType() == NamingSystemIdentifierType.OID && id.getValue().equals(oid))
return true;
}
return false;
}
public void loadFromFolder(String folder) throws FileNotFoundException, Exception {
for (String n : new File(folder).list()) {
if (n.endsWith(".json"))
@ -495,11 +444,6 @@ public class SimpleWorkerContext extends BaseWorkerContext implements IWorkerCon
}
}
public void dropResource(Resource r) throws FHIRException {
throw new FHIRException("Not done yet");
}
public Map<String, byte[]> getBinaries() {
return binaries;
}
@ -519,13 +463,10 @@ public class SimpleWorkerContext extends BaseWorkerContext implements IWorkerCon
return version+"-"+revision;
}
public Map<String, StructureMap> getTransforms() {
return transforms;
}
public List<StructureMap> findTransformsforSource(String url) {
List<StructureMap> res = new ArrayList<StructureMap>();
for (StructureMap map : transforms.values()) {
for (StructureMap map : listTransforms()) {
boolean match = false;
boolean ok = true;
for (StructureMapStructureComponent t : map.getStructure()) {
@ -578,4 +519,7 @@ public class SimpleWorkerContext extends BaseWorkerContext implements IWorkerCon
super.seeMetadataResource(r, map, addId);
}
}

View File

@ -422,6 +422,11 @@ public class Element extends Base {
return type != null ? property.isPrimitive(type) : property.isPrimitive(property.getType(name));
}
@Override
public boolean isBooleanPrimitive() {
return isPrimitive() && ("boolean".equals(type) || "boolean".equals(property.getType(name)));
}
@Override
public boolean isResource() {
return property.isResource();

View File

@ -64,7 +64,7 @@ public class JsonParser extends ParserBase {
@Override
public Element parse(InputStream stream) throws IOException, FHIRFormatError, DefinitionException {
public Element parse(InputStream stream) throws IOException, FHIRException {
// if we're parsing at this point, then we're going to use the custom parser
map = new HashMap<JsonElement, LocationData>();
String source = TextFile.streamToString(stream);
@ -85,12 +85,12 @@ public class JsonParser extends ParserBase {
}
}
public Element parse(JsonObject object, Map<JsonElement, LocationData> map) throws FHIRFormatError, DefinitionException {
public Element parse(JsonObject object, Map<JsonElement, LocationData> map) throws FHIRException {
this.map = map;
return parse(object);
}
public Element parse(JsonObject object) throws FHIRFormatError, DefinitionException {
public Element parse(JsonObject object) throws FHIRException {
JsonElement rt = object.get("resourceType");
if (rt == null) {
logError(line(object), col(object), "$", IssueType.INVALID, "Unable to find resourceType property", IssueSeverity.FATAL);
@ -127,7 +127,7 @@ public class JsonParser extends ParserBase {
}
}
private void parseChildren(String path, JsonObject object, Element context, boolean hasResourceType) throws DefinitionException, FHIRFormatError {
private void parseChildren(String path, JsonObject object, Element context, boolean hasResourceType) throws FHIRException {
reapComments(object, context);
List<Property> properties = context.getProperty().getChildProperties(context.getName(), null);
Set<String> processed = new HashSet<String>();
@ -166,7 +166,7 @@ public class JsonParser extends ParserBase {
}
}
private void parseChildComplex(String path, JsonObject object, Element context, Set<String> processed, Property property, String name) throws FHIRFormatError, DefinitionException {
private void parseChildComplex(String path, JsonObject object, Element context, Set<String> processed, Property property, String name) throws FHIRException {
processed.add(name);
String npath = path+"/"+property.getName();
JsonElement e = object.get(name);
@ -180,7 +180,7 @@ public class JsonParser extends ParserBase {
}
}
private void parseChildComplexInstance(String npath, JsonObject object, Element context, Property property, String name, JsonElement e) throws FHIRFormatError, DefinitionException {
private void parseChildComplexInstance(String npath, JsonObject object, Element context, Property property, String name, JsonElement e) throws FHIRException {
if (e instanceof JsonObject) {
JsonObject child = (JsonObject) e;
Element n = new Element(name, property).markLocation(line(child), col(child));
@ -194,7 +194,7 @@ public class JsonParser extends ParserBase {
logError(line(e), col(e), npath, IssueType.INVALID, "This property must be "+(property.isList() ? "an Array" : "an Object")+", not a "+e.getClass().getName(), IssueSeverity.ERROR);
}
private void parseChildPrimitive(JsonObject object, Element context, Set<String> processed, Property property, String path, String name) throws FHIRFormatError, DefinitionException {
private void parseChildPrimitive(JsonObject object, Element context, Set<String> processed, Property property, String path, String name) throws FHIRException {
String npath = path+"/"+property.getName();
processed.add(name);
processed.add("_"+name);
@ -223,7 +223,7 @@ public class JsonParser extends ParserBase {
}
private void parseChildPrimitiveInstance(Element context, Property property, String name, String npath,
JsonElement main, JsonElement fork) throws FHIRFormatError, DefinitionException {
JsonElement main, JsonElement fork) throws FHIRException {
if (main != null && !(main instanceof JsonPrimitive))
logError(line(main), col(main), npath, IssueType.INVALID, "This property must be an simple value, not a "+main.getClass().getName(), IssueSeverity.ERROR);
else if (fork != null && !(fork instanceof JsonObject))
@ -262,7 +262,7 @@ public class JsonParser extends ParserBase {
}
private void parseResource(String npath, JsonObject res, Element parent, Property elementProperty) throws DefinitionException, FHIRFormatError {
private void parseResource(String npath, JsonObject res, Element parent, Property elementProperty) throws FHIRException {
JsonElement rt = res.get("resourceType");
if (rt == null) {
logError(line(res), col(res), npath, IssueType.INVALID, "Unable to find resourceType property", IssueSeverity.FATAL);

View File

@ -23,7 +23,7 @@ public class ObjectConverter {
this.context = context;
}
public Element convert(Resource ig) throws IOException, FHIRFormatError, DefinitionException {
public Element convert(Resource ig) throws IOException, FHIRException {
if (ig == null)
return null;
ByteArrayOutputStream bs = new ByteArrayOutputStream();
@ -123,6 +123,7 @@ public class ObjectConverter {
Reference r = new Reference();
r.setDisplay(item.getNamedChildValue("display"));
r.setReference(item.getNamedChildValue("reference"));
r.setType(item.getNamedChildValue("type"));
List<Element> identifier = item.getChildrenByName("identifier");
if (identifier.isEmpty() == false) {
r.setIdentifier(readAsIdentifier(identifier.get(0)));

View File

@ -31,7 +31,7 @@ public abstract class ParserBase {
public enum ValidationPolicy { NONE, QUICK, EVERYTHING }
public boolean isPrimitive(String code) {
return Utilities.existsInList(code, "boolean", "integer", "string", "decimal", "uri", "base64Binary", "instant", "date", "dateTime", "time", "code", "oid", "id", "markdown", "unsignedInt", "positiveInt", "xhtml");
return Utilities.existsInList(code, "boolean", "integer", "string", "decimal", "uri", "base64Binary", "instant", "date", "dateTime", "time", "code", "oid", "id", "markdown", "unsignedInt", "positiveInt", "xhtml", "url", "canonical");
// StructureDefinition sd = context.fetchResource(StructureDefinition.class, "http://hl7.org/fhir/StructureDefinition/"+code);
// return sd != null && sd.getKind() == StructureDefinitionKind.PRIMITIVETYPE;

View File

@ -1,372 +1,380 @@
package org.hl7.fhir.r4.elementmodel;
import java.util.ArrayList;
import java.util.List;
import org.hl7.fhir.r4.conformance.ProfileUtilities;
import org.hl7.fhir.r4.context.IWorkerContext;
import org.hl7.fhir.r4.formats.FormatUtilities;
import org.hl7.fhir.r4.model.ElementDefinition;
import org.hl7.fhir.r4.model.ElementDefinition.PropertyRepresentation;
import org.hl7.fhir.r4.model.ElementDefinition.TypeRefComponent;
import org.hl7.fhir.r4.model.StructureDefinition;
import org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKind;
import org.hl7.fhir.r4.model.TypeDetails;
import org.hl7.fhir.r4.utils.ToolingExtensions;
import org.apache.commons.lang3.StringUtils;
import org.hl7.fhir.exceptions.DefinitionException;
public class Property {
private IWorkerContext context;
private ElementDefinition definition;
private StructureDefinition structure;
private Boolean canBePrimitive;
public Property(IWorkerContext context, ElementDefinition definition, StructureDefinition structure) {
this.context = context;
this.definition = definition;
this.structure = structure;
}
public String getName() {
return definition.getPath().substring(definition.getPath().lastIndexOf(".")+1);
}
public ElementDefinition getDefinition() {
return definition;
}
public String getType() {
if (definition.getType().size() == 0)
return null;
else if (definition.getType().size() > 1) {
String tn = definition.getType().get(0).getCode();
for (int i = 1; i < definition.getType().size(); i++) {
if (!tn.equals(definition.getType().get(i).getCode()))
throw new Error("logic error, gettype when types > 1");
}
return tn;
} else
return definition.getType().get(0).getCode();
}
public String getType(String elementName) {
if (!definition.getPath().contains("."))
return definition.getPath();
ElementDefinition ed = definition;
if (definition.hasContentReference()) {
if (!definition.getContentReference().startsWith("#"))
throw new Error("not handled yet");
boolean found = false;
for (ElementDefinition d : structure.getSnapshot().getElement()) {
if (d.hasId() && d.getId().equals(definition.getContentReference().substring(1))) {
found = true;
ed = d;
}
}
if (!found)
throw new Error("Unable to resolve "+definition.getContentReference()+" at "+definition.getPath()+" on "+structure.getUrl());
}
if (ed.getType().size() == 0)
return null;
else if (ed.getType().size() > 1) {
String t = ed.getType().get(0).getCode();
boolean all = true;
for (TypeRefComponent tr : ed.getType()) {
if (!t.equals(tr.getCode()))
all = false;
}
if (all)
return t;
String tail = ed.getPath().substring(ed.getPath().lastIndexOf(".")+1);
if (tail.endsWith("[x]") && elementName != null && elementName.startsWith(tail.substring(0, tail.length()-3))) {
String name = elementName.substring(tail.length()-3);
return isPrimitive(lowFirst(name)) ? lowFirst(name) : name;
} else
throw new Error("logic error, gettype when types > 1, name mismatch for "+elementName+" on at "+ed.getPath());
} else if (ed.getType().get(0).getCode() == null) {
return structure.getId();
} else
return ed.getType().get(0).getCode();
}
public boolean hasType(String elementName) {
if (definition.getType().size() == 0)
return false;
else if (definition.getType().size() > 1) {
String t = definition.getType().get(0).getCode();
boolean all = true;
for (TypeRefComponent tr : definition.getType()) {
if (!t.equals(tr.getCode()))
all = false;
}
if (all)
return true;
String tail = definition.getPath().substring(definition.getPath().lastIndexOf(".")+1);
if (tail.endsWith("[x]") && elementName.startsWith(tail.substring(0, tail.length()-3))) {
String name = elementName.substring(tail.length()-3);
return true;
} else
return false;
} else
return true;
}
public StructureDefinition getStructure() {
return structure;
}
/**
* Is the given name a primitive
*
* @param E.g. "Observation.status"
*/
public boolean isPrimitiveName(String name) {
String code = getType(name);
return isPrimitive(code);
}
/**
* Is the given type a primitive
*
* @param E.g. "integer"
*/
public boolean isPrimitive(String code) {
StructureDefinition sd = context.fetchResource(StructureDefinition.class, "http://hl7.org/fhir/StructureDefinition/"+code);
return sd != null && sd.getKind() == StructureDefinitionKind.PRIMITIVETYPE;
}
private String lowFirst(String t) {
return t.substring(0, 1).toLowerCase()+t.substring(1);
}
public boolean isResource() {
if (definition.getType().size() > 0)
return definition.getType().size() == 1 && ("Resource".equals(definition.getType().get(0).getCode()) || "DomainResource".equals(definition.getType().get(0).getCode()));
else
return !definition.getPath().contains(".") && structure.getKind() == StructureDefinitionKind.RESOURCE;
}
public boolean isList() {
return !"1".equals(definition.getMax());
}
public String getScopedPropertyName() {
return definition.getBase().getPath();
}
public String getNamespace() {
if (ToolingExtensions.hasExtension(definition, "http://hl7.org/fhir/StructureDefinition/elementdefinition-namespace"))
return ToolingExtensions.readStringExtension(definition, "http://hl7.org/fhir/StructureDefinition/elementdefinition-namespace");
if (ToolingExtensions.hasExtension(structure, "http://hl7.org/fhir/StructureDefinition/elementdefinition-namespace"))
return ToolingExtensions.readStringExtension(structure, "http://hl7.org/fhir/StructureDefinition/elementdefinition-namespace");
return FormatUtilities.FHIR_NS;
}
private boolean isElementWithOnlyExtension(final ElementDefinition ed, final List<ElementDefinition> children) {
boolean result = false;
if (!ed.getType().isEmpty()) {
result = true;
for (final ElementDefinition ele : children) {
if (!ele.getPath().contains("extension")) {
result = false;
break;
}
}
}
return result;
}
public boolean IsLogicalAndHasPrimitiveValue(String name) {
// if (canBePrimitive!= null)
// return canBePrimitive;
canBePrimitive = false;
if (structure.getKind() != StructureDefinitionKind.LOGICAL)
return false;
if (!hasType(name))
return false;
StructureDefinition sd = context.fetchResource(StructureDefinition.class, structure.getUrl().substring(0, structure.getUrl().lastIndexOf("/")+1)+getType(name));
if (sd == null)
sd = context.fetchResource(StructureDefinition.class, "http://hl7.org/fhir/StructureDefinition/"+getType(name));
if (sd != null && sd.getKind() == StructureDefinitionKind.PRIMITIVETYPE)
return true;
if (sd == null || sd.getKind() != StructureDefinitionKind.LOGICAL)
return false;
for (ElementDefinition ed : sd.getSnapshot().getElement()) {
if (ed.getPath().equals(sd.getId()+".value") && ed.getType().size() == 1 && isPrimitive(ed.getType().get(0).getCode())) {
canBePrimitive = true;
return true;
}
}
return false;
}
public boolean isChoice() {
if (definition.getType().size() <= 1)
return false;
String tn = definition.getType().get(0).getCode();
for (int i = 1; i < definition.getType().size(); i++)
if (!definition.getType().get(i).getCode().equals(tn))
return true;
return false;
}
protected List<Property> getChildProperties(String elementName, String statedType) throws DefinitionException {
ElementDefinition ed = definition;
StructureDefinition sd = structure;
List<ElementDefinition> children = ProfileUtilities.getChildMap(sd, ed);
if (children.isEmpty() || isElementWithOnlyExtension(ed, children)) {
// ok, find the right definitions
String t = null;
if (ed.getType().size() == 1)
t = ed.getType().get(0).getCode();
else if (ed.getType().size() == 0)
throw new Error("types == 0, and no children found on "+getDefinition().getPath());
else {
t = ed.getType().get(0).getCode();
boolean all = true;
for (TypeRefComponent tr : ed.getType()) {
if (!tr.getCode().equals(t)) {
all = false;
break;
}
}
if (!all) {
// ok, it's polymorphic
if (ed.hasRepresentation(PropertyRepresentation.TYPEATTR)) {
t = statedType;
if (t == null && ToolingExtensions.hasExtension(ed, "http://hl7.org/fhir/StructureDefinition/elementdefinition-defaulttype"))
t = ToolingExtensions.readStringExtension(ed, "http://hl7.org/fhir/StructureDefinition/elementdefinition-defaulttype");
boolean ok = false;
for (TypeRefComponent tr : ed.getType())
if (tr.getCode().equals(t))
ok = true;
if (!ok)
throw new DefinitionException("Type '"+t+"' is not an acceptable type for '"+elementName+"' on property "+definition.getPath());
} else {
t = elementName.substring(tail(ed.getPath()).length() - 3);
if (isPrimitive(lowFirst(t)))
t = lowFirst(t);
}
}
}
if (!"xhtml".equals(t)) {
String url = null;
for (TypeRefComponent aType: ed.getType()) {
if (aType.getCode().equals(t)) {
if (StringUtils.isNotBlank(aType.getProfile())) {
url = aType.getProfile();
} else {
url = "http://hl7.org/fhir/StructureDefinition/" + t;
}
break;
}
}
if (url==null)
throw new Error("Unable to find type " + t + " for element " + elementName + " with path " + ed.getPath());
sd = context.fetchResource(StructureDefinition.class, url);
if (sd == null)
throw new DefinitionException("Unable to find type '"+t+"' for name '"+elementName+"' on property "+definition.getPath());
children = ProfileUtilities.getChildMap(sd, sd.getSnapshot().getElement().get(0));
}
}
List<Property> properties = new ArrayList<Property>();
for (ElementDefinition child : children) {
properties.add(new Property(context, child, sd));
}
return properties;
}
protected List<Property> getChildProperties(TypeDetails type) throws DefinitionException {
ElementDefinition ed = definition;
StructureDefinition sd = structure;
List<ElementDefinition> children = ProfileUtilities.getChildMap(sd, ed);
if (children.isEmpty()) {
// ok, find the right definitions
String t = null;
if (ed.getType().size() == 1)
t = ed.getType().get(0).getCode();
else if (ed.getType().size() == 0)
throw new Error("types == 0, and no children found");
else {
t = ed.getType().get(0).getCode();
boolean all = true;
for (TypeRefComponent tr : ed.getType()) {
if (!tr.getCode().equals(t)) {
all = false;
break;
}
}
if (!all) {
// ok, it's polymorphic
t = type.getType();
}
}
if (!"xhtml".equals(t)) {
sd = context.fetchResource(StructureDefinition.class, t);
if (sd == null)
throw new DefinitionException("Unable to find class '"+t+"' for name '"+ed.getPath()+"' on property "+definition.getPath());
children = ProfileUtilities.getChildMap(sd, sd.getSnapshot().getElement().get(0));
}
}
List<Property> properties = new ArrayList<Property>();
for (ElementDefinition child : children) {
properties.add(new Property(context, child, sd));
}
return properties;
}
private String tail(String path) {
return path.contains(".") ? path.substring(path.lastIndexOf(".")+1) : path;
}
public Property getChild(String elementName, String childName) throws DefinitionException {
List<Property> children = getChildProperties(elementName, null);
for (Property p : children) {
if (p.getName().equals(childName)) {
return p;
}
}
return null;
}
public Property getChild(String name, TypeDetails type) throws DefinitionException {
List<Property> children = getChildProperties(type);
for (Property p : children) {
if (p.getName().equals(name) || p.getName().equals(name+"[x]")) {
return p;
}
}
return null;
}
public Property getChild(String name) throws DefinitionException {
List<Property> children = getChildProperties(name, null);
for (Property p : children) {
if (p.getName().equals(name)) {
return p;
}
}
return null;
}
public Property getChildSimpleName(String elementName, String name) throws DefinitionException {
List<Property> children = getChildProperties(elementName, null);
for (Property p : children) {
if (p.getName().equals(name) || p.getName().equals(name+"[x]")) {
return p;
}
}
return null;
}
public IWorkerContext getContext() {
return context;
}
}
package org.hl7.fhir.r4.elementmodel;
import java.util.ArrayList;
import java.util.List;
import org.hl7.fhir.r4.conformance.ProfileUtilities;
import org.hl7.fhir.r4.context.IWorkerContext;
import org.hl7.fhir.r4.formats.FormatUtilities;
import org.hl7.fhir.r4.model.ElementDefinition;
import org.hl7.fhir.r4.model.ElementDefinition.PropertyRepresentation;
import org.hl7.fhir.r4.model.ElementDefinition.TypeRefComponent;
import org.hl7.fhir.r4.model.StructureDefinition;
import org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKind;
import org.hl7.fhir.r4.model.TypeDetails;
import org.hl7.fhir.r4.utils.ToolingExtensions;
import org.apache.commons.lang3.StringUtils;
import org.hl7.fhir.exceptions.DefinitionException;
import org.hl7.fhir.exceptions.FHIRException;
public class Property {
private IWorkerContext context;
private ElementDefinition definition;
private StructureDefinition structure;
private Boolean canBePrimitive;
public Property(IWorkerContext context, ElementDefinition definition, StructureDefinition structure) {
this.context = context;
this.definition = definition;
this.structure = structure;
}
public String getName() {
return definition.getPath().substring(definition.getPath().lastIndexOf(".")+1);
}
public ElementDefinition getDefinition() {
return definition;
}
public String getType() {
if (definition.getType().size() == 0)
return null;
else if (definition.getType().size() > 1) {
String tn = definition.getType().get(0).getCode();
for (int i = 1; i < definition.getType().size(); i++) {
if (!tn.equals(definition.getType().get(i).getCode()))
throw new Error("logic error, gettype when types > 1");
}
return tn;
} else
return definition.getType().get(0).getCode();
}
public String getType(String elementName) {
if (!definition.getPath().contains("."))
return definition.getPath();
ElementDefinition ed = definition;
if (definition.hasContentReference()) {
if (!definition.getContentReference().startsWith("#"))
throw new Error("not handled yet");
boolean found = false;
for (ElementDefinition d : structure.getSnapshot().getElement()) {
if (d.hasId() && d.getId().equals(definition.getContentReference().substring(1))) {
found = true;
ed = d;
}
}
if (!found)
throw new Error("Unable to resolve "+definition.getContentReference()+" at "+definition.getPath()+" on "+structure.getUrl());
}
if (ed.getType().size() == 0)
return null;
else if (ed.getType().size() > 1) {
String t = ed.getType().get(0).getCode();
boolean all = true;
for (TypeRefComponent tr : ed.getType()) {
if (!t.equals(tr.getCode()))
all = false;
}
if (all)
return t;
String tail = ed.getPath().substring(ed.getPath().lastIndexOf(".")+1);
if (tail.endsWith("[x]") && elementName != null && elementName.startsWith(tail.substring(0, tail.length()-3))) {
String name = elementName.substring(tail.length()-3);
return isPrimitive(lowFirst(name)) ? lowFirst(name) : name;
} else
throw new Error("logic error, gettype when types > 1, name mismatch for "+elementName+" on at "+ed.getPath());
} else if (ed.getType().get(0).getCode() == null) {
return structure.getId();
} else
return ed.getType().get(0).getCode();
}
public boolean hasType(String elementName) {
if (definition.getType().size() == 0)
return false;
else if (definition.getType().size() > 1) {
String t = definition.getType().get(0).getCode();
boolean all = true;
for (TypeRefComponent tr : definition.getType()) {
if (!t.equals(tr.getCode()))
all = false;
}
if (all)
return true;
String tail = definition.getPath().substring(definition.getPath().lastIndexOf(".")+1);
if (tail.endsWith("[x]") && elementName.startsWith(tail.substring(0, tail.length()-3))) {
String name = elementName.substring(tail.length()-3);
return true;
} else
return false;
} else
return true;
}
public StructureDefinition getStructure() {
return structure;
}
/**
* Is the given name a primitive
*
* @param E.g. "Observation.status"
*/
public boolean isPrimitiveName(String name) {
String code = getType(name);
return isPrimitive(code);
}
/**
* Is the given type a primitive
*
* @param E.g. "integer"
*/
public boolean isPrimitive(String code) {
StructureDefinition sd = context.fetchResource(StructureDefinition.class, "http://hl7.org/fhir/StructureDefinition/"+code);
return sd != null && sd.getKind() == StructureDefinitionKind.PRIMITIVETYPE;
}
private String lowFirst(String t) {
return t.substring(0, 1).toLowerCase()+t.substring(1);
}
public boolean isResource() {
if (definition.getType().size() > 0)
return definition.getType().size() == 1 && ("Resource".equals(definition.getType().get(0).getCode()) || "DomainResource".equals(definition.getType().get(0).getCode()));
else
return !definition.getPath().contains(".") && structure.getKind() == StructureDefinitionKind.RESOURCE;
}
public boolean isList() {
return !"1".equals(definition.getMax());
}
public String getScopedPropertyName() {
return definition.getBase().getPath();
}
public String getNamespace() {
if (ToolingExtensions.hasExtension(definition, "http://hl7.org/fhir/StructureDefinition/elementdefinition-namespace"))
return ToolingExtensions.readStringExtension(definition, "http://hl7.org/fhir/StructureDefinition/elementdefinition-namespace");
if (ToolingExtensions.hasExtension(structure, "http://hl7.org/fhir/StructureDefinition/elementdefinition-namespace"))
return ToolingExtensions.readStringExtension(structure, "http://hl7.org/fhir/StructureDefinition/elementdefinition-namespace");
return FormatUtilities.FHIR_NS;
}
private boolean isElementWithOnlyExtension(final ElementDefinition ed, final List<ElementDefinition> children) {
boolean result = false;
if (!ed.getType().isEmpty()) {
result = true;
for (final ElementDefinition ele : children) {
if (!ele.getPath().contains("extension")) {
result = false;
break;
}
}
}
return result;
}
public boolean IsLogicalAndHasPrimitiveValue(String name) {
// if (canBePrimitive!= null)
// return canBePrimitive;
canBePrimitive = false;
if (structure.getKind() != StructureDefinitionKind.LOGICAL)
return false;
if (!hasType(name))
return false;
StructureDefinition sd = context.fetchResource(StructureDefinition.class, structure.getUrl().substring(0, structure.getUrl().lastIndexOf("/")+1)+getType(name));
if (sd == null)
sd = context.fetchResource(StructureDefinition.class, "http://hl7.org/fhir/StructureDefinition/"+getType(name));
if (sd != null && sd.getKind() == StructureDefinitionKind.PRIMITIVETYPE)
return true;
if (sd == null || sd.getKind() != StructureDefinitionKind.LOGICAL)
return false;
for (ElementDefinition ed : sd.getSnapshot().getElement()) {
if (ed.getPath().equals(sd.getId()+".value") && ed.getType().size() == 1 && isPrimitive(ed.getType().get(0).getCode())) {
canBePrimitive = true;
return true;
}
}
return false;
}
public boolean isChoice() {
if (definition.getType().size() <= 1)
return false;
String tn = definition.getType().get(0).getCode();
for (int i = 1; i < definition.getType().size(); i++)
if (!definition.getType().get(i).getCode().equals(tn))
return true;
return false;
}
protected List<Property> getChildProperties(String elementName, String statedType) throws FHIRException {
ElementDefinition ed = definition;
StructureDefinition sd = structure;
List<ElementDefinition> children = ProfileUtilities.getChildMap(sd, ed);
if (children.isEmpty() || isElementWithOnlyExtension(ed, children)) {
// ok, find the right definitions
String t = null;
if (ed.getType().size() == 1)
t = ed.getType().get(0).getCode();
else if (ed.getType().size() == 0)
throw new Error("types == 0, and no children found on "+getDefinition().getPath());
else {
t = ed.getType().get(0).getCode();
boolean all = true;
for (TypeRefComponent tr : ed.getType()) {
if (!tr.getCode().equals(t)) {
all = false;
break;
}
}
if (!all) {
// ok, it's polymorphic
if (ed.hasRepresentation(PropertyRepresentation.TYPEATTR)) {
t = statedType;
if (t == null && ToolingExtensions.hasExtension(ed, "http://hl7.org/fhir/StructureDefinition/elementdefinition-defaulttype"))
t = ToolingExtensions.readStringExtension(ed, "http://hl7.org/fhir/StructureDefinition/elementdefinition-defaulttype");
boolean ok = false;
for (TypeRefComponent tr : ed.getType())
if (tr.getCode().equals(t))
ok = true;
if (!ok)
throw new DefinitionException("Type '"+t+"' is not an acceptable type for '"+elementName+"' on property "+definition.getPath());
} else {
t = elementName.substring(tail(ed.getPath()).length() - 3);
if (isPrimitive(lowFirst(t)))
t = lowFirst(t);
}
}
}
if (!"xhtml".equals(t)) {
String url = null;
for (TypeRefComponent aType: ed.getType()) {
if (aType.getCode().equals(t)) {
if (aType.hasProfile()) {
assert aType.getProfile().size() == 1;
url = aType.getProfile().get(0).getValue();
} else {
url = "http://hl7.org/fhir/StructureDefinition/" + t;
}
break;
}
}
if (url==null)
throw new FHIRException("Unable to find type " + t + " for element " + elementName + " with path " + ed.getPath());
sd = context.fetchResource(StructureDefinition.class, url);
if (sd == null)
throw new DefinitionException("Unable to find type '"+t+"' for name '"+elementName+"' on property "+definition.getPath());
children = ProfileUtilities.getChildMap(sd, sd.getSnapshot().getElement().get(0));
}
}
List<Property> properties = new ArrayList<Property>();
for (ElementDefinition child : children) {
properties.add(new Property(context, child, sd));
}
return properties;
}
protected List<Property> getChildProperties(TypeDetails type) throws DefinitionException {
ElementDefinition ed = definition;
StructureDefinition sd = structure;
List<ElementDefinition> children = ProfileUtilities.getChildMap(sd, ed);
if (children.isEmpty()) {
// ok, find the right definitions
String t = null;
if (ed.getType().size() == 1)
t = ed.getType().get(0).getCode();
else if (ed.getType().size() == 0)
throw new Error("types == 0, and no children found");
else {
t = ed.getType().get(0).getCode();
boolean all = true;
for (TypeRefComponent tr : ed.getType()) {
if (!tr.getCode().equals(t)) {
all = false;
break;
}
}
if (!all) {
// ok, it's polymorphic
t = type.getType();
}
}
if (!"xhtml".equals(t)) {
sd = context.fetchResource(StructureDefinition.class, t);
if (sd == null)
throw new DefinitionException("Unable to find class '"+t+"' for name '"+ed.getPath()+"' on property "+definition.getPath());
children = ProfileUtilities.getChildMap(sd, sd.getSnapshot().getElement().get(0));
}
}
List<Property> properties = new ArrayList<Property>();
for (ElementDefinition child : children) {
properties.add(new Property(context, child, sd));
}
return properties;
}
private String tail(String path) {
return path.contains(".") ? path.substring(path.lastIndexOf(".")+1) : path;
}
public Property getChild(String elementName, String childName) throws FHIRException {
List<Property> children = getChildProperties(elementName, null);
for (Property p : children) {
if (p.getName().equals(childName)) {
return p;
}
}
return null;
}
public Property getChild(String name, TypeDetails type) throws DefinitionException {
List<Property> children = getChildProperties(type);
for (Property p : children) {
if (p.getName().equals(name) || p.getName().equals(name+"[x]")) {
return p;
}
}
return null;
}
public Property getChild(String name) throws FHIRException {
List<Property> children = getChildProperties(name, null);
for (Property p : children) {
if (p.getName().equals(name)) {
return p;
}
}
return null;
}
public Property getChildSimpleName(String elementName, String name) throws FHIRException {
List<Property> children = getChildProperties(elementName, null);
for (Property p : children) {
if (p.getName().equals(name) || p.getName().equals(name+"[x]")) {
return p;
}
}
return null;
}
public IWorkerContext getContext() {
return context;
}
@Override
public String toString() {
return definition.getPath();
}
}

View File

@ -43,7 +43,7 @@ public class TurtleParser extends ParserBase {
super(context);
}
@Override
public Element parse(InputStream input) throws IOException, FHIRFormatError, DefinitionException {
public Element parse(InputStream input) throws IOException, FHIRException {
Turtle src = new Turtle();
if (policy == ValidationPolicy.EVERYTHING) {
try {
@ -59,7 +59,7 @@ public class TurtleParser extends ParserBase {
}
}
private Element parse(Turtle src) throws FHIRFormatError, DefinitionException {
private Element parse(Turtle src) throws FHIRException {
// we actually ignore the stated URL here
for (TTLComplex cmp : src.getObjects().values()) {
for (String p : cmp.getPredicates().keySet()) {
@ -78,7 +78,7 @@ public class TurtleParser extends ParserBase {
}
}
private Element parse(Turtle src, TTLComplex cmp) throws FHIRFormatError, DefinitionException {
private Element parse(Turtle src, TTLComplex cmp) throws FHIRException {
TTLObject type = cmp.getPredicates().get("http://www.w3.org/2000/01/rdf-schema#type");
if (type == null) {
logError(cmp.getLine(), cmp.getCol(), "(document)", IssueType.INVALID, "Unknown resource type (missing rdfs:type)", IssueSeverity.FATAL);
@ -114,7 +114,7 @@ public class TurtleParser extends ParserBase {
return result;
}
private void parseChildren(Turtle src, String path, TTLComplex object, Element context, boolean primitive) throws FHIRFormatError, DefinitionException {
private void parseChildren(Turtle src, String path, TTLComplex object, Element context, boolean primitive) throws FHIRException {
List<Property> properties = context.getProperty().getChildProperties(context.getName(), null);
Set<String> processed = new HashSet<String>();
@ -145,7 +145,7 @@ public class TurtleParser extends ParserBase {
}
}
private void parseChild(Turtle src, TTLComplex object, Element context, Set<String> processed, Property property, String path, String name) throws FHIRFormatError, DefinitionException {
private void parseChild(Turtle src, TTLComplex object, Element context, Set<String> processed, Property property, String path, String name) throws FHIRException {
processed.add(name);
String npath = path+"/"+property.getName();
TTLObject e = object.getPredicates().get(FHIR_URI_BASE + name);
@ -161,7 +161,7 @@ public class TurtleParser extends ParserBase {
}
}
private void parseChildInstance(Turtle src, String npath, TTLComplex object, Element context, Property property, String name, TTLObject e) throws FHIRFormatError, DefinitionException {
private void parseChildInstance(Turtle src, String npath, TTLComplex object, Element context, Property property, String name, TTLObject e) throws FHIRException {
if (property.isResource())
parseResource(src, npath, object, context, property, name, e);
else if (e instanceof TTLComplex) {
@ -192,7 +192,7 @@ public class TurtleParser extends ParserBase {
return name.substring(name.lastIndexOf(".")+1);
}
private void parseResource(Turtle src, String npath, TTLComplex object, Element context, Property property, String name, TTLObject e) throws FHIRFormatError, DefinitionException {
private void parseResource(Turtle src, String npath, TTLComplex object, Element context, Property property, String name, TTLObject e) throws FHIRException {
TTLComplex obj;
if (e instanceof TTLComplex)
obj = (TTLComplex) e;
@ -322,6 +322,12 @@ public class TurtleParser extends ParserBase {
t.linkedPredicate("fhir:link", refURI, linkResolver == null ? null : linkResolver.resolvePage("rdf.html#reference"));
}
protected void decorateCanonical(Complex t, Element canonical) {
String refURI = canonical.primitiveValue();
if(refURI != null)
t.linkedPredicate("fhir:link", refURI, linkResolver == null ? null : linkResolver.resolvePage("rdf.html#reference"));
}
private String genSubjectId(Element e) {
String id = e.getChildValue("id");
if (base == null || id == null)
@ -365,9 +371,20 @@ public class TurtleParser extends ParserBase {
if ("Coding".equals(element.getType()))
decorateCoding(t, element, section);
if ("Reference".equals(element.getType()))
if (Utilities.existsInList(element.getType(), "Reference"))
decorateReference(t, element);
else if (Utilities.existsInList(element.getType(), "canonical"))
decorateCanonical(t, element);
if("canonical".equals(element.getType())) {
String refURI = element.primitiveValue();
if (refURI != null) {
String uriType = getURIType(refURI);
if(uriType != null && !section.hasSubject(refURI))
section.triple(refURI, "a", "fhir:" + uriType);
}
}
if("Reference".equals(element.getType())) {
String refURI = getReferenceURI(element.getChildValue("reference"));
if (refURI != null) {

View File

@ -242,7 +242,7 @@ public class XmlParser extends ParserBase {
else
context.getChildren().add(new Element(property.getName(), property, property.getType(), av).markLocation(line(node), col(node)));
} else if (!allowXsiLocation || !attr.getNodeName().endsWith(":schemaLocation") ) {
logError(line(node), col(node), path, IssueType.STRUCTURE, "Undefined attribute '@"+attr.getNodeName()+"' on "+node.getNodeName(), IssueSeverity.ERROR);
logError(line(node), col(node), path, IssueType.STRUCTURE, "Undefined attribute '@"+attr.getNodeName()+"' on "+node.getNodeName()+" for type "+context.fhirType()+" (properties = "+properties+")", IssueSeverity.ERROR);
}
}
}

View File

@ -91,6 +91,16 @@ public abstract class FormatUtilities {
throw new Error("unsupported Format "+format.toString());
}
public static ParserBase makeParser(String format) {
if ("XML".equalsIgnoreCase(format)) return new XmlParser();
if ("JSON".equalsIgnoreCase(format)) return new JsonParser();
if ("TURTLE".equalsIgnoreCase(format)) throw new Error("unsupported Format "+format.toString()); // return new TurtleParser();
if ("JSONLD".equalsIgnoreCase(format)) throw new Error("unsupported Format "+format.toString()); // return new JsonLdParser();
if ("VBAR".equalsIgnoreCase(format)) throw new Error("unsupported Format "+format.toString()); //
if ("TEXT".equalsIgnoreCase(format)) throw new Error("unsupported Format "+format.toString()); //
throw new Error("unsupported Format "+format);
}
public static FhirFormat determineFormat(byte[] source) throws FHIRException {
return determineFormat(source, MAX_SCAN_LENGTH);
}

View File

@ -1,26 +1,28 @@
package org.hl7.fhir.r4.formats;
import org.hl7.fhir.r4.elementmodel.Manager.FhirFormat;
import org.hl7.fhir.r4.formats.IParser.OutputStyle;
public class ParserFactory {
public static IParser parser(FhirFormat format) {
switch (format) {
case JSON : return new JsonParser();
case XML : return new XmlParser();
default:
throw new Error("Not supported at this time");
}
}
public static IParser parser(FhirFormat format, OutputStyle style) {
switch (format) {
case JSON : return new JsonParser().setOutputStyle(style);
case XML : return new XmlParser().setOutputStyle(style);
default:
throw new Error("Not supported at this time");
}
}
}
package org.hl7.fhir.r4.formats;
import org.hl7.fhir.r4.elementmodel.Manager.FhirFormat;
import org.hl7.fhir.r4.formats.IParser.OutputStyle;
public class ParserFactory {
public static IParser parser(FhirFormat format) {
switch (format) {
case JSON : return new JsonParser();
case XML : return new XmlParser();
case TURTLE : return new RdfParser();
default:
throw new Error("Not supported at this time");
}
}
public static IParser parser(FhirFormat format, OutputStyle style) {
switch (format) {
case JSON : return new JsonParser().setOutputStyle(style);
case XML : return new XmlParser().setOutputStyle(style);
case TURTLE : return new RdfParser().setOutputStyle(style);
default:
throw new Error("Not supported at this time");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,98 @@
package org.hl7.fhir.r4.formats;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import org.hl7.fhir.r4.model.CodeType;
import org.hl7.fhir.r4.model.CodeableConcept;
import org.hl7.fhir.r4.model.Coding;
import org.hl7.fhir.r4.model.Enumeration;
import org.hl7.fhir.r4.model.Resource;
import org.hl7.fhir.r4.model.Type;
import org.hl7.fhir.r4.utils.formats.Turtle;
import org.hl7.fhir.r4.utils.formats.Turtle.Complex;
import org.hl7.fhir.r4.utils.formats.Turtle.Section;
import org.hl7.fhir.r4.utils.formats.Turtle.Subject;
import org.hl7.fhir.exceptions.FHIRFormatError;
import org.hl7.fhir.utilities.xhtml.XhtmlNode;
public abstract class RdfParserBase extends ParserBase implements IParser {
protected abstract void composeResource(Complex complex, Resource resource) throws IOException;
@Override
public ParserType getType() {
return ParserType.RDF_TURTLE;
}
@Override
public Resource parse(InputStream input) throws IOException, FHIRFormatError {
throw new Error("Parsing not implemented yet");
}
@Override
public Type parseType(InputStream input, String knownType) throws IOException, FHIRFormatError {
throw new Error("Parsing not implemented yet");
}
private String url;
@Override
public void compose(OutputStream stream, Resource resource) throws IOException {
Turtle ttl = new Turtle();
// ttl.setFormat(FFormat);
ttl.prefix("fhir", "http://hl7.org/fhir/");
ttl.prefix("rdfs", "http://www.w3.org/2000/01/rdf-schema#");
Section section = ttl.section("resource");
Subject subject;
if (url != null)
subject = section.triple("<"+url+">", "a", "fhir:"+resource.getResourceType().toString());
else
subject = section.triple("[]", "a", "fhir:"+resource.getResourceType().toString());
composeResource(subject, resource);
try {
ttl.commit(stream, false);
} catch (Exception e) {
throw new IOException(e);
}
}
@Override
public void compose(OutputStream stream, Type type, String rootName) throws IOException {
throw new Error("Not supported in RDF");
}
protected String ttlLiteral(String value) {
return "\"" +Turtle.escape(value, true) + "\"";
}
protected void composeXhtml(Complex t, String string, String string2, XhtmlNode div, int i) {
}
protected void decorateCode(Complex t, Enumeration<? extends Enum> value) {
}
protected void decorateCode(Complex t, CodeType value) {
}
protected void decorateCoding(Complex t, Coding element) {
if (!element.hasSystem())
return;
if ("http://snomed.info/sct".equals(element.getSystem())) {
t.prefix("sct", "http://snomed.info/sct/");
t.predicate("a", "sct:"+element.getCode());
} else if ("http://snomed.info/sct".equals(element.getSystem())) {
t.prefix("loinc", "http://loinc.org/rdf#");
t.predicate("a", "loinc:"+element.getCode());
}
}
protected void decorateCodeableConcept(Complex t, CodeableConcept element) {
for (Coding c : element.getCoding())
decorateCoding(t, c);
}
}

View File

@ -311,6 +311,16 @@ public final class HapiWorkerContext implements IWorkerContext, ValueSetExpander
throw new UnsupportedOperationException();
}
@Override
public List<StructureMap> listTransforms() {
throw new UnsupportedOperationException();
}
@Override
public StructureMap getTransform(String url) {
throw new UnsupportedOperationException();
}
@Override
public List<String> getTypeNames() {
throw new UnsupportedOperationException();

View File

@ -174,9 +174,6 @@ public class ServerCapabilityStatementProvider implements IServerConformanceProv
retVal.setPublisher(myPublisher);
retVal.setDateElement(conformanceDate());
retVal.setFhirVersion(FhirVersionEnum.R4.getFhirVersionString());
retVal.setAcceptUnknown(UnknownContentCode.EXTENSIONS); // TODO: make this configurable - this is a fairly big
// effort since the parser
// needs to be modified to actually allow it
retVal.getImplementation().setDescription(myServerConfiguration.getImplementationDescription());
retVal.setKind(CapabilityStatementKind.INSTANCE);
@ -203,7 +200,7 @@ public class ServerCapabilityStatementProvider implements IServerConformanceProv
resource.getTypeElement().setValue(def.getName());
ServletContext servletContext = (ServletContext) (theRequest == null ? null : theRequest.getAttribute(RestfulServer.SERVLET_CONTEXT_ATTRIBUTE));
String serverBase = myServerConfiguration.getServerAddressStrategy().determineServerBase(servletContext, theRequest);
resource.getProfile().setReference((def.getResourceProfile(serverBase)));
resource.getProfileElement().setValue(def.getResourceProfile(serverBase));
TreeSet<String> includes = new TreeSet<String>();
@ -267,7 +264,7 @@ public class ServerCapabilityStatementProvider implements IServerConformanceProv
String opName = myOperationBindingToName.get(methodBinding);
if (operationNames.add(opName)) {
// Only add each operation (by name) once
rest.addOperation().setName(methodBinding.getName().substring(1)).setDefinition(new Reference("OperationDefinition/" + opName));
rest.addOperation().setName(methodBinding.getName().substring(1)).setDefinition("OperationDefinition/" + opName);
}
}
@ -302,7 +299,7 @@ public class ServerCapabilityStatementProvider implements IServerConformanceProv
String opName = myOperationBindingToName.get(methodBinding);
if (operationNames.add(opName)) {
ourLog.debug("Found bound operation: {}", opName);
rest.addOperation().setName(methodBinding.getName().substring(1)).setDefinition(new Reference("OperationDefinition/" + opName));
rest.addOperation().setName(methodBinding.getName().substring(1)).setDefinition("OperationDefinition/" + opName);
}
}
}
@ -316,7 +313,7 @@ public class ServerCapabilityStatementProvider implements IServerConformanceProv
private void handleDynamicSearchMethodBinding(CapabilityStatementRestResourceComponent resource, RuntimeResourceDefinition def, TreeSet<String> includes, DynamicSearchMethodBinding searchMethodBinding) {
includes.addAll(searchMethodBinding.getIncludes());
List<RuntimeSearchParam> searchParameters = new ArrayList<RuntimeSearchParam>();
List<RuntimeSearchParam> searchParameters = new ArrayList<>();
searchParameters.addAll(searchMethodBinding.getSearchParams());
sortRuntimeSearchParameters(searchParameters);

View File

@ -29,7 +29,7 @@ package org.hl7.fhir.r4.model;
*/
// Generated on Tue, Jan 9, 2018 14:51-0500 for FHIR v3.2.0
// Generated on Thu, Mar 1, 2018 20:26+1100 for FHIR v3.2.0
import java.util.*;
@ -61,6 +61,14 @@ public class Account extends DomainResource {
* This instance should not have been part of this patient's medical record.
*/
ENTEREDINERROR,
/**
* This account is on hold
*/
ONHOLD,
/**
* The ccount status is unknown
*/
UNKNOWN,
/**
* added to help the parsers with the generic types
*/
@ -74,6 +82,10 @@ public class Account extends DomainResource {
return INACTIVE;
if ("entered-in-error".equals(codeString))
return ENTEREDINERROR;
if ("on-hold".equals(codeString))
return ONHOLD;
if ("unknown".equals(codeString))
return UNKNOWN;
if (Configuration.isAcceptInvalidEnums())
return null;
else
@ -84,6 +96,8 @@ public class Account extends DomainResource {
case ACTIVE: return "active";
case INACTIVE: return "inactive";
case ENTEREDINERROR: return "entered-in-error";
case ONHOLD: return "on-hold";
case UNKNOWN: return "unknown";
default: return "?";
}
}
@ -92,6 +106,8 @@ public class Account extends DomainResource {
case ACTIVE: return "http://hl7.org/fhir/account-status";
case INACTIVE: return "http://hl7.org/fhir/account-status";
case ENTEREDINERROR: return "http://hl7.org/fhir/account-status";
case ONHOLD: return "http://hl7.org/fhir/account-status";
case UNKNOWN: return "http://hl7.org/fhir/account-status";
default: return "?";
}
}
@ -100,6 +116,8 @@ public class Account extends DomainResource {
case ACTIVE: return "This account is active and may be used.";
case INACTIVE: return "This account is inactive and should not be used to track financial information.";
case ENTEREDINERROR: return "This instance should not have been part of this patient's medical record.";
case ONHOLD: return "This account is on hold";
case UNKNOWN: return "The ccount status is unknown";
default: return "?";
}
}
@ -108,6 +126,8 @@ public class Account extends DomainResource {
case ACTIVE: return "Active";
case INACTIVE: return "Inactive";
case ENTEREDINERROR: return "Entered in error";
case ONHOLD: return "On Hold";
case UNKNOWN: return "Unknown";
default: return "?";
}
}
@ -124,6 +144,10 @@ public class Account extends DomainResource {
return AccountStatus.INACTIVE;
if ("entered-in-error".equals(codeString))
return AccountStatus.ENTEREDINERROR;
if ("on-hold".equals(codeString))
return AccountStatus.ONHOLD;
if ("unknown".equals(codeString))
return AccountStatus.UNKNOWN;
throw new IllegalArgumentException("Unknown AccountStatus code '"+codeString+"'");
}
public Enumeration<AccountStatus> fromType(Base code) throws FHIRException {
@ -140,6 +164,10 @@ public class Account extends DomainResource {
return new Enumeration<AccountStatus>(this, AccountStatus.INACTIVE);
if ("entered-in-error".equals(codeString))
return new Enumeration<AccountStatus>(this, AccountStatus.ENTEREDINERROR);
if ("on-hold".equals(codeString))
return new Enumeration<AccountStatus>(this, AccountStatus.ONHOLD);
if ("unknown".equals(codeString))
return new Enumeration<AccountStatus>(this, AccountStatus.UNKNOWN);
throw new FHIRException("Unknown AccountStatus code '"+codeString+"'");
}
public String toCode(AccountStatus code) {
@ -149,6 +177,10 @@ public class Account extends DomainResource {
return "inactive";
if (code == AccountStatus.ENTEREDINERROR)
return "entered-in-error";
if (code == AccountStatus.ONHOLD)
return "on-hold";
if (code == AccountStatus.UNKNOWN)
return "unknown";
return "?";
}
public String toSystem(AccountStatus code) {
@ -720,8 +752,8 @@ A coverage may only be resposible for specific types of charges, and the sequenc
/**
* Indicates whether the account is presently used/usable or not.
*/
@Child(name = "status", type = {CodeType.class}, order=1, min=0, max=1, modifier=true, summary=true)
@Description(shortDefinition="active | inactive | entered-in-error", formalDefinition="Indicates whether the account is presently used/usable or not." )
@Child(name = "status", type = {CodeType.class}, order=1, min=1, max=1, modifier=true, summary=true)
@Description(shortDefinition="active | inactive | entered-in-error | on-hold | unknown", formalDefinition="Indicates whether the account is presently used/usable or not." )
@ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/account-status")
protected Enumeration<AccountStatus> status;
@ -753,31 +785,23 @@ A coverage may only be resposible for specific types of charges, and the sequenc
protected Resource subjectTarget;
/**
* Identifies the period of time the account applies to; e.g. accounts created per fiscal year, quarter, etc.
* The date range of services associated with this account.
*/
@Child(name = "period", type = {Period.class}, order=5, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="Transaction window", formalDefinition="Identifies the period of time the account applies to; e.g. accounts created per fiscal year, quarter, etc." )
protected Period period;
/**
* Indicates the period of time over which the account is allowed to have transactions posted to it.
This period may be different to the coveragePeriod which is the duration of time that services may occur.
*/
@Child(name = "active", type = {Period.class}, order=6, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="Time window that transactions may be posted to this account", formalDefinition="Indicates the period of time over which the account is allowed to have transactions posted to it.\nThis period may be different to the coveragePeriod which is the duration of time that services may occur." )
protected Period active;
@Child(name = "servicePeriod", type = {Period.class}, order=5, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="Transaction window", formalDefinition="The date range of services associated with this account." )
protected Period servicePeriod;
/**
* The party(s) that are responsible for covering the payment of this account, and what order should they be applied to the account.
*/
@Child(name = "coverage", type = {}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
@Child(name = "coverage", type = {}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
@Description(shortDefinition="The party(s) that are responsible for covering the payment of this account, and what order should they be applied to the account", formalDefinition="The party(s) that are responsible for covering the payment of this account, and what order should they be applied to the account." )
protected List<CoverageComponent> coverage;
/**
* Indicates the organization, department, etc. with responsibility for the account.
*/
@Child(name = "owner", type = {Organization.class}, order=8, min=0, max=1, modifier=false, summary=true)
@Child(name = "owner", type = {Organization.class}, order=7, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="Who is responsible?", formalDefinition="Indicates the organization, department, etc. with responsibility for the account." )
protected Reference owner;
@ -789,21 +813,21 @@ This period may be different to the coveragePeriod which is the duration of time
/**
* Provides additional information about what the account tracks and how it is used.
*/
@Child(name = "description", type = {StringType.class}, order=9, min=0, max=1, modifier=false, summary=true)
@Child(name = "description", type = {StringType.class}, order=8, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="Explanation of purpose/use", formalDefinition="Provides additional information about what the account tracks and how it is used." )
protected StringType description;
/**
* Parties financially responsible for the account.
*/
@Child(name = "guarantor", type = {}, order=10, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
@Child(name = "guarantor", type = {}, order=9, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
@Description(shortDefinition="Responsible for the account", formalDefinition="Parties financially responsible for the account." )
protected List<GuarantorComponent> guarantor;
/**
* Reference to a parent Account.
*/
@Child(name = "partOf", type = {Account.class}, order=11, min=0, max=1, modifier=false, summary=false)
@Child(name = "partOf", type = {Account.class}, order=10, min=0, max=1, modifier=false, summary=false)
@Description(shortDefinition="Reference to a parent Account", formalDefinition="Reference to a parent Account." )
protected Reference partOf;
@ -812,7 +836,7 @@ This period may be different to the coveragePeriod which is the duration of time
*/
protected Account partOfTarget;
private static final long serialVersionUID = -1380598431L;
private static final long serialVersionUID = 516897815L;
/**
* Constructor
@ -821,6 +845,14 @@ This period may be different to the coveragePeriod which is the duration of time
super();
}
/**
* Constructor
*/
public Account(Enumeration<AccountStatus> status) {
super();
this.status = status;
}
/**
* @return {@link #identifier} (Unique identifier used to reference the account. Might or might not be intended for human use (e.g. credit card number).)
*/
@ -913,13 +945,9 @@ This period may be different to the coveragePeriod which is the duration of time
* @param value Indicates whether the account is presently used/usable or not.
*/
public Account setStatus(AccountStatus value) {
if (value == null)
this.status = null;
else {
if (this.status == null)
this.status = new Enumeration<AccountStatus>(new AccountStatusEnumFactory());
this.status.setValue(value);
}
return this;
}
@ -1036,52 +1064,26 @@ This period may be different to the coveragePeriod which is the duration of time
}
/**
* @return {@link #period} (Identifies the period of time the account applies to; e.g. accounts created per fiscal year, quarter, etc.)
* @return {@link #servicePeriod} (The date range of services associated with this account.)
*/
public Period getPeriod() {
if (this.period == null)
public Period getServicePeriod() {
if (this.servicePeriod == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create Account.period");
throw new Error("Attempt to auto-create Account.servicePeriod");
else if (Configuration.doAutoCreate())
this.period = new Period(); // cc
return this.period;
this.servicePeriod = new Period(); // cc
return this.servicePeriod;
}
public boolean hasPeriod() {
return this.period != null && !this.period.isEmpty();
public boolean hasServicePeriod() {
return this.servicePeriod != null && !this.servicePeriod.isEmpty();
}
/**
* @param value {@link #period} (Identifies the period of time the account applies to; e.g. accounts created per fiscal year, quarter, etc.)
* @param value {@link #servicePeriod} (The date range of services associated with this account.)
*/
public Account setPeriod(Period value) {
this.period = value;
return this;
}
/**
* @return {@link #active} (Indicates the period of time over which the account is allowed to have transactions posted to it.
This period may be different to the coveragePeriod which is the duration of time that services may occur.)
*/
public Period getActive() {
if (this.active == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create Account.active");
else if (Configuration.doAutoCreate())
this.active = new Period(); // cc
return this.active;
}
public boolean hasActive() {
return this.active != null && !this.active.isEmpty();
}
/**
* @param value {@link #active} (Indicates the period of time over which the account is allowed to have transactions posted to it.
This period may be different to the coveragePeriod which is the duration of time that services may occur.)
*/
public Account setActive(Period value) {
this.active = value;
public Account setServicePeriod(Period value) {
this.servicePeriod = value;
return this;
}
@ -1335,8 +1337,7 @@ This period may be different to the coveragePeriod which is the duration of time
children.add(new Property("type", "CodeableConcept", "Categorizes the account for reporting and searching purposes.", 0, 1, type));
children.add(new Property("name", "string", "Name used for the account when displaying it to humans in reports, etc.", 0, 1, name));
children.add(new Property("subject", "Reference(Patient|Device|Practitioner|Location|HealthcareService|Organization)", "Identifies the patient, device, practitioner, location or other object the account is associated with.", 0, 1, subject));
children.add(new Property("period", "Period", "Identifies the period of time the account applies to; e.g. accounts created per fiscal year, quarter, etc.", 0, 1, period));
children.add(new Property("active", "Period", "Indicates the period of time over which the account is allowed to have transactions posted to it.\nThis period may be different to the coveragePeriod which is the duration of time that services may occur.", 0, 1, active));
children.add(new Property("servicePeriod", "Period", "The date range of services associated with this account.", 0, 1, servicePeriod));
children.add(new Property("coverage", "", "The party(s) that are responsible for covering the payment of this account, and what order should they be applied to the account.", 0, java.lang.Integer.MAX_VALUE, coverage));
children.add(new Property("owner", "Reference(Organization)", "Indicates the organization, department, etc. with responsibility for the account.", 0, 1, owner));
children.add(new Property("description", "string", "Provides additional information about what the account tracks and how it is used.", 0, 1, description));
@ -1352,8 +1353,7 @@ This period may be different to the coveragePeriod which is the duration of time
case 3575610: /*type*/ return new Property("type", "CodeableConcept", "Categorizes the account for reporting and searching purposes.", 0, 1, type);
case 3373707: /*name*/ return new Property("name", "string", "Name used for the account when displaying it to humans in reports, etc.", 0, 1, name);
case -1867885268: /*subject*/ return new Property("subject", "Reference(Patient|Device|Practitioner|Location|HealthcareService|Organization)", "Identifies the patient, device, practitioner, location or other object the account is associated with.", 0, 1, subject);
case -991726143: /*period*/ return new Property("period", "Period", "Identifies the period of time the account applies to; e.g. accounts created per fiscal year, quarter, etc.", 0, 1, period);
case -1422950650: /*active*/ return new Property("active", "Period", "Indicates the period of time over which the account is allowed to have transactions posted to it.\nThis period may be different to the coveragePeriod which is the duration of time that services may occur.", 0, 1, active);
case 2129104086: /*servicePeriod*/ return new Property("servicePeriod", "Period", "The date range of services associated with this account.", 0, 1, servicePeriod);
case -351767064: /*coverage*/ return new Property("coverage", "", "The party(s) that are responsible for covering the payment of this account, and what order should they be applied to the account.", 0, java.lang.Integer.MAX_VALUE, coverage);
case 106164915: /*owner*/ return new Property("owner", "Reference(Organization)", "Indicates the organization, department, etc. with responsibility for the account.", 0, 1, owner);
case -1724546052: /*description*/ return new Property("description", "string", "Provides additional information about what the account tracks and how it is used.", 0, 1, description);
@ -1372,8 +1372,7 @@ This period may be different to the coveragePeriod which is the duration of time
case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
case 3373707: /*name*/ return this.name == null ? new Base[0] : new Base[] {this.name}; // StringType
case -1867885268: /*subject*/ return this.subject == null ? new Base[0] : new Base[] {this.subject}; // Reference
case -991726143: /*period*/ return this.period == null ? new Base[0] : new Base[] {this.period}; // Period
case -1422950650: /*active*/ return this.active == null ? new Base[0] : new Base[] {this.active}; // Period
case 2129104086: /*servicePeriod*/ return this.servicePeriod == null ? new Base[0] : new Base[] {this.servicePeriod}; // Period
case -351767064: /*coverage*/ return this.coverage == null ? new Base[0] : this.coverage.toArray(new Base[this.coverage.size()]); // CoverageComponent
case 106164915: /*owner*/ return this.owner == null ? new Base[0] : new Base[] {this.owner}; // Reference
case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // StringType
@ -1403,11 +1402,8 @@ This period may be different to the coveragePeriod which is the duration of time
case -1867885268: // subject
this.subject = castToReference(value); // Reference
return value;
case -991726143: // period
this.period = castToPeriod(value); // Period
return value;
case -1422950650: // active
this.active = castToPeriod(value); // Period
case 2129104086: // servicePeriod
this.servicePeriod = castToPeriod(value); // Period
return value;
case -351767064: // coverage
this.getCoverage().add((CoverageComponent) value); // CoverageComponent
@ -1442,10 +1438,8 @@ This period may be different to the coveragePeriod which is the duration of time
this.name = castToString(value); // StringType
} else if (name.equals("subject")) {
this.subject = castToReference(value); // Reference
} else if (name.equals("period")) {
this.period = castToPeriod(value); // Period
} else if (name.equals("active")) {
this.active = castToPeriod(value); // Period
} else if (name.equals("servicePeriod")) {
this.servicePeriod = castToPeriod(value); // Period
} else if (name.equals("coverage")) {
this.getCoverage().add((CoverageComponent) value);
} else if (name.equals("owner")) {
@ -1469,8 +1463,7 @@ This period may be different to the coveragePeriod which is the duration of time
case 3575610: return getType();
case 3373707: return getNameElement();
case -1867885268: return getSubject();
case -991726143: return getPeriod();
case -1422950650: return getActive();
case 2129104086: return getServicePeriod();
case -351767064: return addCoverage();
case 106164915: return getOwner();
case -1724546052: return getDescriptionElement();
@ -1489,8 +1482,7 @@ This period may be different to the coveragePeriod which is the duration of time
case 3575610: /*type*/ return new String[] {"CodeableConcept"};
case 3373707: /*name*/ return new String[] {"string"};
case -1867885268: /*subject*/ return new String[] {"Reference"};
case -991726143: /*period*/ return new String[] {"Period"};
case -1422950650: /*active*/ return new String[] {"Period"};
case 2129104086: /*servicePeriod*/ return new String[] {"Period"};
case -351767064: /*coverage*/ return new String[] {};
case 106164915: /*owner*/ return new String[] {"Reference"};
case -1724546052: /*description*/ return new String[] {"string"};
@ -1520,13 +1512,9 @@ This period may be different to the coveragePeriod which is the duration of time
this.subject = new Reference();
return this.subject;
}
else if (name.equals("period")) {
this.period = new Period();
return this.period;
}
else if (name.equals("active")) {
this.active = new Period();
return this.active;
else if (name.equals("servicePeriod")) {
this.servicePeriod = new Period();
return this.servicePeriod;
}
else if (name.equals("coverage")) {
return addCoverage();
@ -1566,8 +1554,7 @@ This period may be different to the coveragePeriod which is the duration of time
dst.type = type == null ? null : type.copy();
dst.name = name == null ? null : name.copy();
dst.subject = subject == null ? null : subject.copy();
dst.period = period == null ? null : period.copy();
dst.active = active == null ? null : active.copy();
dst.servicePeriod = servicePeriod == null ? null : servicePeriod.copy();
if (coverage != null) {
dst.coverage = new ArrayList<CoverageComponent>();
for (CoverageComponent i : coverage)
@ -1596,10 +1583,9 @@ This period may be different to the coveragePeriod which is the duration of time
return false;
Account o = (Account) other_;
return compareDeep(identifier, o.identifier, true) && compareDeep(status, o.status, true) && compareDeep(type, o.type, true)
&& compareDeep(name, o.name, true) && compareDeep(subject, o.subject, true) && compareDeep(period, o.period, true)
&& compareDeep(active, o.active, true) && compareDeep(coverage, o.coverage, true) && compareDeep(owner, o.owner, true)
&& compareDeep(description, o.description, true) && compareDeep(guarantor, o.guarantor, true) && compareDeep(partOf, o.partOf, true)
;
&& compareDeep(name, o.name, true) && compareDeep(subject, o.subject, true) && compareDeep(servicePeriod, o.servicePeriod, true)
&& compareDeep(coverage, o.coverage, true) && compareDeep(owner, o.owner, true) && compareDeep(description, o.description, true)
&& compareDeep(guarantor, o.guarantor, true) && compareDeep(partOf, o.partOf, true);
}
@Override
@ -1615,7 +1601,7 @@ This period may be different to the coveragePeriod which is the duration of time
public boolean isEmpty() {
return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, status, type
, name, subject, period, active, coverage, owner, description, guarantor, partOf
, name, subject, servicePeriod, coverage, owner, description, guarantor, partOf
);
}
@ -1675,17 +1661,17 @@ This period may be different to the coveragePeriod which is the duration of time
* <p>
* Description: <b>Transaction window</b><br>
* Type: <b>date</b><br>
* Path: <b>Account.period</b><br>
* Path: <b>Account.servicePeriod</b><br>
* </p>
*/
@SearchParamDefinition(name="period", path="Account.period", description="Transaction window", type="date" )
@SearchParamDefinition(name="period", path="Account.servicePeriod", description="Transaction window", type="date" )
public static final String SP_PERIOD = "period";
/**
* <b>Fluent Client</b> search parameter constant for <b>period</b>
* <p>
* Description: <b>Transaction window</b><br>
* Type: <b>date</b><br>
* Path: <b>Account.period</b><br>
* Path: <b>Account.servicePeriod</b><br>
* </p>
*/
public static final ca.uhn.fhir.rest.gclient.DateClientParam PERIOD = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_PERIOD);
@ -1785,17 +1771,17 @@ This period may be different to the coveragePeriod which is the duration of time
/**
* Search parameter: <b>status</b>
* <p>
* Description: <b>active | inactive | entered-in-error</b><br>
* Description: <b>active | inactive | entered-in-error | on-hold | unknown</b><br>
* Type: <b>token</b><br>
* Path: <b>Account.status</b><br>
* </p>
*/
@SearchParamDefinition(name="status", path="Account.status", description="active | inactive | entered-in-error", type="token" )
@SearchParamDefinition(name="status", path="Account.status", description="active | inactive | entered-in-error | on-hold | unknown", type="token" )
public static final String SP_STATUS = "status";
/**
* <b>Fluent Client</b> search parameter constant for <b>status</b>
* <p>
* Description: <b>active | inactive | entered-in-error</b><br>
* Description: <b>active | inactive | entered-in-error | on-hold | unknown</b><br>
* Type: <b>token</b><br>
* Path: <b>Account.status</b><br>
* </p>

View File

@ -29,7 +29,7 @@ package org.hl7.fhir.r4.model;
*/
// Generated on Tue, Jan 9, 2018 14:51-0500 for FHIR v3.2.0
// Generated on Thu, Mar 1, 2018 20:26+1100 for FHIR v3.2.0
import java.util.*;
@ -129,7 +129,7 @@ into another (possibly the same) biological entity.
*/
CLINICALIMPRESSION,
/**
* A code system resource specifies a set of codes drawn from one or more code systems.
* The CodeSystem resource is used to declare the existence of and describe a code system or code system supplement and its key properties, and optionally define a part or all of its content.
*/
CODESYSTEM,
/**
@ -145,7 +145,7 @@ into another (possibly the same) biological entity.
*/
COMPARTMENTDEFINITION,
/**
* A set of healthcare-related information that is assembled together into a single logical document that provides a single coherent statement of meaning, establishes its own context and that has clinical attestation with regard to who is making the statement. While a Composition defines the structure, it does not actually contain the content: rather the full content of a document is contained in a Bundle, of which the Composition is the first resource contained.
* A set of healthcare-related information that is assembled together into a single logical package that provides a single coherent statement of meaning, establishes its own context and that has clinical attestation with regard to who is making the statement. A Composition defines the structure and narrative content necessary for a document. However, a Composition alone does not constitute a document. Rather, the Composition must be the first entry in a Bundle where Bundle.type=document, and any other resources referenced from Composition must be included as subsequent entries in the Bundle (for example Patient, Practitioner, Encounter, etc.).
*/
COMPOSITION,
/**
@ -421,7 +421,7 @@ into another (possibly the same) biological entity.
*/
OBSERVATIONDEFINITION,
/**
* Patients or family member's work information.
* A person's work information, structured to facilitate individual, population, and public health use; not intended to support billing.
*/
OCCUPATIONALDATA,
/**
@ -1239,11 +1239,11 @@ into another (possibly the same) biological entity.
case CLAIM: return "A provider issued list of services and products provided, or to be provided, to a patient which is provided to an insurer for payment recovery.";
case CLAIMRESPONSE: return "This resource provides the adjudication details from the processing of a Claim resource.";
case CLINICALIMPRESSION: return "A record of a clinical assessment performed to determine what problem(s) may affect the patient and before planning the treatments or management strategies that are best to manage a patient's condition. Assessments are often 1:1 with a clinical consultation / encounter, but this varies greatly depending on the clinical workflow. This resource is called \"ClinicalImpression\" rather than \"ClinicalAssessment\" to avoid confusion with the recording of assessment tools such as Apgar score.";
case CODESYSTEM: return "A code system resource specifies a set of codes drawn from one or more code systems.";
case CODESYSTEM: return "The CodeSystem resource is used to declare the existence of and describe a code system or code system supplement and its key properties, and optionally define a part or all of its content.";
case COMMUNICATION: return "An occurrence of information being transmitted; e.g. an alert that was sent to a responsible provider, a public health agency was notified about a reportable condition.";
case COMMUNICATIONREQUEST: return "A request to convey information; e.g. the CDS system proposes that an alert be sent to a responsible provider, the CDS system proposes that the public health agency be notified about a reportable condition.";
case COMPARTMENTDEFINITION: return "A compartment definition that defines how resources are accessed on a server.";
case COMPOSITION: return "A set of healthcare-related information that is assembled together into a single logical document that provides a single coherent statement of meaning, establishes its own context and that has clinical attestation with regard to who is making the statement. While a Composition defines the structure, it does not actually contain the content: rather the full content of a document is contained in a Bundle, of which the Composition is the first resource contained.";
case COMPOSITION: return "A set of healthcare-related information that is assembled together into a single logical package that provides a single coherent statement of meaning, establishes its own context and that has clinical attestation with regard to who is making the statement. A Composition defines the structure and narrative content necessary for a document. However, a Composition alone does not constitute a document. Rather, the Composition must be the first entry in a Bundle where Bundle.type=document, and any other resources referenced from Composition must be included as subsequent entries in the Bundle (for example Patient, Practitioner, Encounter, etc.).";
case CONCEPTMAP: return "A statement of relationships from one set of concepts to one or more other concepts - either code systems or data elements, or classes in class models.";
case CONDITION: return "A clinical condition, problem, diagnosis, or other event, situation, issue, or clinical concept that has risen to a level of concern.";
case CONSENT: return "A record of a healthcare consumers choices, which permits or denies identified recipient(s) or recipient role(s) to perform one or more actions within a given policy context, for specific purposes and periods of time.";
@ -1312,7 +1312,7 @@ into another (possibly the same) biological entity.
case NUTRITIONORDER: return "A request to supply a diet, formula feeding (enteral) or oral nutritional supplement to a patient/resident.";
case OBSERVATION: return "Measurements and simple assertions made about a patient, device or other subject.";
case OBSERVATIONDEFINITION: return "Set of definitional characteristics for a kind of observation or measurement produced or consumed by an orderable health care service.";
case OCCUPATIONALDATA: return "Patients or family member's work information.";
case OCCUPATIONALDATA: return "A person's work information, structured to facilitate individual, population, and public health use; not intended to support billing.";
case OPERATIONDEFINITION: return "A formal computable definition of an operation (on the RESTful interface) or a named query (using the search interaction).";
case OPERATIONOUTCOME: return "A collection of error, warning or information messages that result from a system action.";
case ORGANIZATION: return "A formally or informally recognized grouping of people or organizations formed for the purpose of achieving some form of collective action. Includes companies, institutions, corporations, departments, community groups, healthcare practice groups, etc.";

View File

@ -29,7 +29,7 @@ package org.hl7.fhir.r4.model;
*/
// Generated on Tue, Jan 9, 2018 14:51-0500 for FHIR v3.2.0
// Generated on Thu, Mar 1, 2018 20:26+1100 for FHIR v3.2.0
import java.util.*;
@ -579,7 +579,7 @@ public class Address extends Type implements ICompositeType {
if (this.line == null)
return false;
for (StringType v : this.line)
if (v.equals(value)) // string
if (v.getValue().equals(value)) // string
return true;
return false;
}

View File

@ -29,7 +29,7 @@ package org.hl7.fhir.r4.model;
*/
// Generated on Tue, Jan 9, 2018 14:51-0500 for FHIR v3.2.0
// Generated on Thu, Mar 1, 2018 20:26+1100 for FHIR v3.2.0
import java.util.*;
@ -145,7 +145,7 @@ public class AdverseEvent extends DomainResource {
/**
* Identifies the actual instance of what caused the adverse event. May be a substance, medication, medication administration, medication statement or a device.
*/
@Child(name = "instance", type = {Substance.class, Medication.class, MedicationAdministration.class, MedicationStatement.class, Device.class}, order=1, min=1, max=1, modifier=false, summary=true)
@Child(name = "instance", type = {Immunization.class, Procedure.class, Substance.class, Medication.class, MedicationAdministration.class, MedicationStatement.class, Device.class}, order=1, min=1, max=1, modifier=false, summary=true)
@Description(shortDefinition="Refers to the specific entity that caused the adverse event", formalDefinition="Identifies the actual instance of what caused the adverse event. May be a substance, medication, medication administration, medication statement or a device." )
protected Reference instance;
@ -272,14 +272,14 @@ public class AdverseEvent extends DomainResource {
protected void listChildren(List<Property> children) {
super.listChildren(children);
children.add(new Property("instance", "Reference(Substance|Medication|MedicationAdministration|MedicationStatement|Device)", "Identifies the actual instance of what caused the adverse event. May be a substance, medication, medication administration, medication statement or a device.", 0, 1, instance));
children.add(new Property("instance", "Reference(Immunization|Procedure|Substance|Medication|MedicationAdministration|MedicationStatement|Device)", "Identifies the actual instance of what caused the adverse event. May be a substance, medication, medication administration, medication statement or a device.", 0, 1, instance));
children.add(new Property("causality", "", "Information on the possible cause of the event.", 0, java.lang.Integer.MAX_VALUE, causality));
}
@Override
public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
switch (_hash) {
case 555127957: /*instance*/ return new Property("instance", "Reference(Substance|Medication|MedicationAdministration|MedicationStatement|Device)", "Identifies the actual instance of what caused the adverse event. May be a substance, medication, medication administration, medication statement or a device.", 0, 1, instance);
case 555127957: /*instance*/ return new Property("instance", "Reference(Immunization|Procedure|Substance|Medication|MedicationAdministration|MedicationStatement|Device)", "Identifies the actual instance of what caused the adverse event. May be a substance, medication, medication administration, medication statement or a device.", 0, 1, instance);
case -1446450521: /*causality*/ return new Property("causality", "", "Information on the possible cause of the event.", 0, java.lang.Integer.MAX_VALUE, causality);
default: return super.getNamedProperty(_hash, _name, _checkValid);
}
@ -766,28 +766,40 @@ public class AdverseEvent extends DomainResource {
protected CodeableConcept event;
/**
* This subject or group impacted by the event. With a prospective adverse event, there will be no subject as the adverse event was prevented.
* This subject or group impacted by the event.
*/
@Child(name = "subject", type = {Patient.class, Group.class, Practitioner.class, RelatedPerson.class}, order=4, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="Subject impacted by event", formalDefinition="This subject or group impacted by the event. With a prospective adverse event, there will be no subject as the adverse event was prevented." )
@Child(name = "subject", type = {Patient.class, Group.class, Practitioner.class, RelatedPerson.class}, order=4, min=1, max=1, modifier=false, summary=true)
@Description(shortDefinition="Subject impacted by event", formalDefinition="This subject or group impacted by the event." )
protected Reference subject;
/**
* The actual object that is the target of the reference (This subject or group impacted by the event. With a prospective adverse event, there will be no subject as the adverse event was prevented.)
* The actual object that is the target of the reference (This subject or group impacted by the event.)
*/
protected Resource subjectTarget;
/**
* The encounter or episode of care that establishes the context for this AdverseEvent.
*/
@Child(name = "context", type = {Encounter.class, EpisodeOfCare.class}, order=5, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="Encounter or episode of care that establishes the context for this AdverseEvent", formalDefinition="The encounter or episode of care that establishes the context for this AdverseEvent." )
protected Reference context;
/**
* The actual object that is the target of the reference (The encounter or episode of care that establishes the context for this AdverseEvent.)
*/
protected Resource contextTarget;
/**
* The date (and perhaps time) when the adverse event occurred.
*/
@Child(name = "date", type = {DateTimeType.class}, order=5, min=0, max=1, modifier=false, summary=true)
@Child(name = "date", type = {DateTimeType.class}, order=6, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="When the event occurred", formalDefinition="The date (and perhaps time) when the adverse event occurred." )
protected DateTimeType date;
/**
* Includes information about the reaction that occurred as a result of exposure to a substance (for example, a drug or a chemical).
*/
@Child(name = "resultingCondition", type = {Condition.class}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
@Child(name = "resultingCondition", type = {Condition.class}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
@Description(shortDefinition="Effect on the subject due to this event", formalDefinition="Includes information about the reaction that occurred as a result of exposure to a substance (for example, a drug or a chemical)." )
protected List<Reference> resultingCondition;
/**
@ -799,7 +811,7 @@ public class AdverseEvent extends DomainResource {
/**
* The information about where the adverse event occurred.
*/
@Child(name = "location", type = {Location.class}, order=7, min=0, max=1, modifier=false, summary=true)
@Child(name = "location", type = {Location.class}, order=8, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="Location where adverse event occurred", formalDefinition="The information about where the adverse event occurred." )
protected Reference location;
@ -811,7 +823,7 @@ public class AdverseEvent extends DomainResource {
/**
* Assessment whether this event was of real importance.
*/
@Child(name = "seriousness", type = {CodeableConcept.class}, order=8, min=0, max=1, modifier=false, summary=true)
@Child(name = "seriousness", type = {CodeableConcept.class}, order=9, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="Seriousness of the event", formalDefinition="Assessment whether this event was of real importance." )
@ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/adverse-event-seriousness")
protected CodeableConcept seriousness;
@ -819,7 +831,7 @@ public class AdverseEvent extends DomainResource {
/**
* Describes the severity of the adverse event, in relation to the subject. Contrast to AdverseEvent.serious - a severe rash might not be serious, but a mild heart problem is.
*/
@Child(name = "severity", type = {CodeableConcept.class}, order=9, min=0, max=1, modifier=false, summary=true)
@Child(name = "severity", type = {CodeableConcept.class}, order=10, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="Mild | Moderate | Severe", formalDefinition="Describes the severity of the adverse event, in relation to the subject. Contrast to AdverseEvent.serious - a severe rash might not be serious, but a mild heart problem is." )
@ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/adverse-event-severity")
protected CodeableConcept severity;
@ -827,7 +839,7 @@ public class AdverseEvent extends DomainResource {
/**
* Describes the type of outcome from the adverse event.
*/
@Child(name = "outcome", type = {CodeableConcept.class}, order=10, min=0, max=1, modifier=false, summary=true)
@Child(name = "outcome", type = {CodeableConcept.class}, order=11, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="resolved | recovering | ongoing | resolvedWithSequelae | fatal | unknown", formalDefinition="Describes the type of outcome from the adverse event." )
@ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/adverse-event-outcome")
protected CodeableConcept outcome;
@ -835,7 +847,7 @@ public class AdverseEvent extends DomainResource {
/**
* Information on who recorded the adverse event. May be the patient or a practitioner.
*/
@Child(name = "recorder", type = {Patient.class, Practitioner.class, RelatedPerson.class}, order=11, min=0, max=1, modifier=false, summary=true)
@Child(name = "recorder", type = {Patient.class, Practitioner.class, RelatedPerson.class}, order=12, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="Who recorded the adverse event", formalDefinition="Information on who recorded the adverse event. May be the patient or a practitioner." )
protected Reference recorder;
@ -845,23 +857,16 @@ public class AdverseEvent extends DomainResource {
protected Resource recorderTarget;
/**
* Parties that may or should contribute or have contributed information to the Act. Such information includes information leading to the decision to perform the Act and how to perform the Act (e.g. consultant), information that the Act itself seeks to reveal (e.g. informant of clinical history), or information about what Act was performed (e.g. informant witness).
* Parties that may or should contribute or have contributed information to the adverse event, which can consist of one or more activities. Such information includes information leading to the decision to perform the activity and how to perform the activity (e.g. consultant), information that the activity itself seeks to reveal (e.g. informant of clinical history), or information about what activity was performed (e.g. informant witness).
*/
@Child(name = "eventParticipant", type = {Practitioner.class, Device.class}, order=12, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="Who was involved in the adverse event or the potential adverse event", formalDefinition="Parties that may or should contribute or have contributed information to the Act. Such information includes information leading to the decision to perform the Act and how to perform the Act (e.g. consultant), information that the Act itself seeks to reveal (e.g. informant of clinical history), or information about what Act was performed (e.g. informant witness)." )
protected Reference eventParticipant;
@Child(name = "contributor", type = {Practitioner.class, Device.class}, order=13, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
@Description(shortDefinition="Who was involved in the adverse event or the potential adverse event", formalDefinition="Parties that may or should contribute or have contributed information to the adverse event, which can consist of one or more activities. Such information includes information leading to the decision to perform the activity and how to perform the activity (e.g. consultant), information that the activity itself seeks to reveal (e.g. informant of clinical history), or information about what activity was performed (e.g. informant witness)." )
protected List<Reference> contributor;
/**
* The actual object that is the target of the reference (Parties that may or should contribute or have contributed information to the Act. Such information includes information leading to the decision to perform the Act and how to perform the Act (e.g. consultant), information that the Act itself seeks to reveal (e.g. informant of clinical history), or information about what Act was performed (e.g. informant witness).)
* The actual objects that are the target of the reference (Parties that may or should contribute or have contributed information to the adverse event, which can consist of one or more activities. Such information includes information leading to the decision to perform the activity and how to perform the activity (e.g. consultant), information that the activity itself seeks to reveal (e.g. informant of clinical history), or information about what activity was performed (e.g. informant witness).)
*/
protected Resource eventParticipantTarget;
protected List<Resource> contributorTarget;
/**
* Describes the adverse event in text.
*/
@Child(name = "description", type = {StringType.class}, order=13, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="Description of the adverse event", formalDefinition="Describes the adverse event in text." )
protected StringType description;
/**
* Describes the entity that is suspected to have caused the adverse event.
@ -873,7 +878,7 @@ public class AdverseEvent extends DomainResource {
/**
* AdverseEvent.subjectMedicalHistory.
*/
@Child(name = "subjectMedicalHistory", type = {Condition.class, Observation.class, AllergyIntolerance.class, FamilyMemberHistory.class, Immunization.class, Procedure.class}, order=15, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
@Child(name = "subjectMedicalHistory", type = {Condition.class, Observation.class, AllergyIntolerance.class, FamilyMemberHistory.class, Immunization.class, Procedure.class, Media.class, DocumentReference.class}, order=15, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
@Description(shortDefinition="AdverseEvent.subjectMedicalHistory", formalDefinition="AdverseEvent.subjectMedicalHistory." )
protected List<Reference> subjectMedicalHistory;
/**
@ -906,7 +911,7 @@ public class AdverseEvent extends DomainResource {
protected List<ResearchStudy> studyTarget;
private static final long serialVersionUID = -570008273L;
private static final long serialVersionUID = 1159243052L;
/**
* Constructor
@ -918,9 +923,10 @@ public class AdverseEvent extends DomainResource {
/**
* Constructor
*/
public AdverseEvent(Enumeration<AdverseEventActuality> actuality) {
public AdverseEvent(Enumeration<AdverseEventActuality> actuality, Reference subject) {
super();
this.actuality = actuality;
this.subject = subject;
}
/**
@ -1070,7 +1076,7 @@ public class AdverseEvent extends DomainResource {
}
/**
* @return {@link #subject} (This subject or group impacted by the event. With a prospective adverse event, there will be no subject as the adverse event was prevented.)
* @return {@link #subject} (This subject or group impacted by the event.)
*/
public Reference getSubject() {
if (this.subject == null)
@ -1086,7 +1092,7 @@ public class AdverseEvent extends DomainResource {
}
/**
* @param value {@link #subject} (This subject or group impacted by the event. With a prospective adverse event, there will be no subject as the adverse event was prevented.)
* @param value {@link #subject} (This subject or group impacted by the event.)
*/
public AdverseEvent setSubject(Reference value) {
this.subject = value;
@ -1094,20 +1100,59 @@ public class AdverseEvent extends DomainResource {
}
/**
* @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. (This subject or group impacted by the event. With a prospective adverse event, there will be no subject as the adverse event was prevented.)
* @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. (This subject or group impacted by the event.)
*/
public Resource getSubjectTarget() {
return this.subjectTarget;
}
/**
* @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. (This subject or group impacted by the event. With a prospective adverse event, there will be no subject as the adverse event was prevented.)
* @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. (This subject or group impacted by the event.)
*/
public AdverseEvent setSubjectTarget(Resource value) {
this.subjectTarget = value;
return this;
}
/**
* @return {@link #context} (The encounter or episode of care that establishes the context for this AdverseEvent.)
*/
public Reference getContext() {
if (this.context == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create AdverseEvent.context");
else if (Configuration.doAutoCreate())
this.context = new Reference(); // cc
return this.context;
}
public boolean hasContext() {
return this.context != null && !this.context.isEmpty();
}
/**
* @param value {@link #context} (The encounter or episode of care that establishes the context for this AdverseEvent.)
*/
public AdverseEvent setContext(Reference value) {
this.context = value;
return this;
}
/**
* @return {@link #context} 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 encounter or episode of care that establishes the context for this AdverseEvent.)
*/
public Resource getContextTarget() {
return this.contextTarget;
}
/**
* @param value {@link #context} 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 encounter or episode of care that establishes the context for this AdverseEvent.)
*/
public AdverseEvent setContextTarget(Resource value) {
this.contextTarget = value;
return this;
}
/**
* @return {@link #date} (The date (and perhaps time) when the adverse event occurred.). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value
*/
@ -1388,91 +1433,66 @@ public class AdverseEvent extends DomainResource {
}
/**
* @return {@link #eventParticipant} (Parties that may or should contribute or have contributed information to the Act. Such information includes information leading to the decision to perform the Act and how to perform the Act (e.g. consultant), information that the Act itself seeks to reveal (e.g. informant of clinical history), or information about what Act was performed (e.g. informant witness).)
* @return {@link #contributor} (Parties that may or should contribute or have contributed information to the adverse event, which can consist of one or more activities. Such information includes information leading to the decision to perform the activity and how to perform the activity (e.g. consultant), information that the activity itself seeks to reveal (e.g. informant of clinical history), or information about what activity was performed (e.g. informant witness).)
*/
public Reference getEventParticipant() {
if (this.eventParticipant == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create AdverseEvent.eventParticipant");
else if (Configuration.doAutoCreate())
this.eventParticipant = new Reference(); // cc
return this.eventParticipant;
}
public boolean hasEventParticipant() {
return this.eventParticipant != null && !this.eventParticipant.isEmpty();
public List<Reference> getContributor() {
if (this.contributor == null)
this.contributor = new ArrayList<Reference>();
return this.contributor;
}
/**
* @param value {@link #eventParticipant} (Parties that may or should contribute or have contributed information to the Act. Such information includes information leading to the decision to perform the Act and how to perform the Act (e.g. consultant), information that the Act itself seeks to reveal (e.g. informant of clinical history), or information about what Act was performed (e.g. informant witness).)
* @return Returns a reference to <code>this</code> for easy method chaining
*/
public AdverseEvent setEventParticipant(Reference value) {
this.eventParticipant = value;
public AdverseEvent setContributor(List<Reference> theContributor) {
this.contributor = theContributor;
return this;
}
public boolean hasContributor() {
if (this.contributor == null)
return false;
for (Reference item : this.contributor)
if (!item.isEmpty())
return true;
return false;
}
public Reference addContributor() { //3
Reference t = new Reference();
if (this.contributor == null)
this.contributor = new ArrayList<Reference>();
this.contributor.add(t);
return t;
}
public AdverseEvent addContributor(Reference t) { //3
if (t == null)
return this;
if (this.contributor == null)
this.contributor = new ArrayList<Reference>();
this.contributor.add(t);
return this;
}
/**
* @return {@link #eventParticipant} 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. (Parties that may or should contribute or have contributed information to the Act. Such information includes information leading to the decision to perform the Act and how to perform the Act (e.g. consultant), information that the Act itself seeks to reveal (e.g. informant of clinical history), or information about what Act was performed (e.g. informant witness).)
* @return The first repetition of repeating field {@link #contributor}, creating it if it does not already exist
*/
public Resource getEventParticipantTarget() {
return this.eventParticipantTarget;
}
/**
* @param value {@link #eventParticipant} 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. (Parties that may or should contribute or have contributed information to the Act. Such information includes information leading to the decision to perform the Act and how to perform the Act (e.g. consultant), information that the Act itself seeks to reveal (e.g. informant of clinical history), or information about what Act was performed (e.g. informant witness).)
*/
public AdverseEvent setEventParticipantTarget(Resource value) {
this.eventParticipantTarget = value;
return this;
}
/**
* @return {@link #description} (Describes the adverse event in text.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
*/
public StringType getDescriptionElement() {
if (this.description == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create AdverseEvent.description");
else if (Configuration.doAutoCreate())
this.description = new StringType(); // bb
return this.description;
}
public boolean hasDescriptionElement() {
return this.description != null && !this.description.isEmpty();
}
public boolean hasDescription() {
return this.description != null && !this.description.isEmpty();
}
/**
* @param value {@link #description} (Describes the adverse event in text.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
*/
public AdverseEvent setDescriptionElement(StringType value) {
this.description = value;
return this;
}
/**
* @return Describes the adverse event in text.
*/
public String getDescription() {
return this.description == null ? null : this.description.getValue();
}
/**
* @param value Describes the adverse event in text.
*/
public AdverseEvent setDescription(String value) {
if (Utilities.noString(value))
this.description = null;
else {
if (this.description == null)
this.description = new StringType();
this.description.setValue(value);
public Reference getContributorFirstRep() {
if (getContributor().isEmpty()) {
addContributor();
}
return this;
return getContributor().get(0);
}
/**
* @deprecated Use Reference#setResource(IBaseResource) instead
*/
@Deprecated
public List<Resource> getContributorTarget() {
if (this.contributorTarget == null)
this.contributorTarget = new ArrayList<Resource>();
return this.contributorTarget;
}
/**
@ -1747,7 +1767,8 @@ public class AdverseEvent extends DomainResource {
children.add(new Property("actuality", "code", "Whether the event actually happened, or just had the potential to. Note that this is independent of whether anyone was affected or harmed or how severely.", 0, 1, actuality));
children.add(new Property("category", "CodeableConcept", "The overall type of event, intended for search and filtering purposes.", 0, java.lang.Integer.MAX_VALUE, category));
children.add(new Property("event", "CodeableConcept", "This element defines the specific type of event that occurred or that was prevented from occurring.", 0, 1, event));
children.add(new Property("subject", "Reference(Patient|Group|Practitioner|RelatedPerson)", "This subject or group impacted by the event. With a prospective adverse event, there will be no subject as the adverse event was prevented.", 0, 1, subject));
children.add(new Property("subject", "Reference(Patient|Group|Practitioner|RelatedPerson)", "This subject or group impacted by the event.", 0, 1, subject));
children.add(new Property("context", "Reference(Encounter|EpisodeOfCare)", "The encounter or episode of care that establishes the context for this AdverseEvent.", 0, 1, context));
children.add(new Property("date", "dateTime", "The date (and perhaps time) when the adverse event occurred.", 0, 1, date));
children.add(new Property("resultingCondition", "Reference(Condition)", "Includes information about the reaction that occurred as a result of exposure to a substance (for example, a drug or a chemical).", 0, java.lang.Integer.MAX_VALUE, resultingCondition));
children.add(new Property("location", "Reference(Location)", "The information about where the adverse event occurred.", 0, 1, location));
@ -1755,10 +1776,9 @@ public class AdverseEvent extends DomainResource {
children.add(new Property("severity", "CodeableConcept", "Describes the severity of the adverse event, in relation to the subject. Contrast to AdverseEvent.serious - a severe rash might not be serious, but a mild heart problem is.", 0, 1, severity));
children.add(new Property("outcome", "CodeableConcept", "Describes the type of outcome from the adverse event.", 0, 1, outcome));
children.add(new Property("recorder", "Reference(Patient|Practitioner|RelatedPerson)", "Information on who recorded the adverse event. May be the patient or a practitioner.", 0, 1, recorder));
children.add(new Property("eventParticipant", "Reference(Practitioner|Device)", "Parties that may or should contribute or have contributed information to the Act. Such information includes information leading to the decision to perform the Act and how to perform the Act (e.g. consultant), information that the Act itself seeks to reveal (e.g. informant of clinical history), or information about what Act was performed (e.g. informant witness).", 0, 1, eventParticipant));
children.add(new Property("description", "string", "Describes the adverse event in text.", 0, 1, description));
children.add(new Property("contributor", "Reference(Practitioner|Device)", "Parties that may or should contribute or have contributed information to the adverse event, which can consist of one or more activities. Such information includes information leading to the decision to perform the activity and how to perform the activity (e.g. consultant), information that the activity itself seeks to reveal (e.g. informant of clinical history), or information about what activity was performed (e.g. informant witness).", 0, java.lang.Integer.MAX_VALUE, contributor));
children.add(new Property("suspectEntity", "", "Describes the entity that is suspected to have caused the adverse event.", 0, java.lang.Integer.MAX_VALUE, suspectEntity));
children.add(new Property("subjectMedicalHistory", "Reference(Condition|Observation|AllergyIntolerance|FamilyMemberHistory|Immunization|Procedure)", "AdverseEvent.subjectMedicalHistory.", 0, java.lang.Integer.MAX_VALUE, subjectMedicalHistory));
children.add(new Property("subjectMedicalHistory", "Reference(Condition|Observation|AllergyIntolerance|FamilyMemberHistory|Immunization|Procedure|Media|DocumentReference)", "AdverseEvent.subjectMedicalHistory.", 0, java.lang.Integer.MAX_VALUE, subjectMedicalHistory));
children.add(new Property("referenceDocument", "Reference(DocumentReference)", "AdverseEvent.referenceDocument.", 0, java.lang.Integer.MAX_VALUE, referenceDocument));
children.add(new Property("study", "Reference(ResearchStudy)", "AdverseEvent.study.", 0, java.lang.Integer.MAX_VALUE, study));
}
@ -1770,7 +1790,8 @@ public class AdverseEvent extends DomainResource {
case 528866400: /*actuality*/ return new Property("actuality", "code", "Whether the event actually happened, or just had the potential to. Note that this is independent of whether anyone was affected or harmed or how severely.", 0, 1, actuality);
case 50511102: /*category*/ return new Property("category", "CodeableConcept", "The overall type of event, intended for search and filtering purposes.", 0, java.lang.Integer.MAX_VALUE, category);
case 96891546: /*event*/ return new Property("event", "CodeableConcept", "This element defines the specific type of event that occurred or that was prevented from occurring.", 0, 1, event);
case -1867885268: /*subject*/ return new Property("subject", "Reference(Patient|Group|Practitioner|RelatedPerson)", "This subject or group impacted by the event. With a prospective adverse event, there will be no subject as the adverse event was prevented.", 0, 1, subject);
case -1867885268: /*subject*/ return new Property("subject", "Reference(Patient|Group|Practitioner|RelatedPerson)", "This subject or group impacted by the event.", 0, 1, subject);
case 951530927: /*context*/ return new Property("context", "Reference(Encounter|EpisodeOfCare)", "The encounter or episode of care that establishes the context for this AdverseEvent.", 0, 1, context);
case 3076014: /*date*/ return new Property("date", "dateTime", "The date (and perhaps time) when the adverse event occurred.", 0, 1, date);
case -830261258: /*resultingCondition*/ return new Property("resultingCondition", "Reference(Condition)", "Includes information about the reaction that occurred as a result of exposure to a substance (for example, a drug or a chemical).", 0, java.lang.Integer.MAX_VALUE, resultingCondition);
case 1901043637: /*location*/ return new Property("location", "Reference(Location)", "The information about where the adverse event occurred.", 0, 1, location);
@ -1778,10 +1799,9 @@ public class AdverseEvent extends DomainResource {
case 1478300413: /*severity*/ return new Property("severity", "CodeableConcept", "Describes the severity of the adverse event, in relation to the subject. Contrast to AdverseEvent.serious - a severe rash might not be serious, but a mild heart problem is.", 0, 1, severity);
case -1106507950: /*outcome*/ return new Property("outcome", "CodeableConcept", "Describes the type of outcome from the adverse event.", 0, 1, outcome);
case -799233858: /*recorder*/ return new Property("recorder", "Reference(Patient|Practitioner|RelatedPerson)", "Information on who recorded the adverse event. May be the patient or a practitioner.", 0, 1, recorder);
case 270753849: /*eventParticipant*/ return new Property("eventParticipant", "Reference(Practitioner|Device)", "Parties that may or should contribute or have contributed information to the Act. Such information includes information leading to the decision to perform the Act and how to perform the Act (e.g. consultant), information that the Act itself seeks to reveal (e.g. informant of clinical history), or information about what Act was performed (e.g. informant witness).", 0, 1, eventParticipant);
case -1724546052: /*description*/ return new Property("description", "string", "Describes the adverse event in text.", 0, 1, description);
case -1895276325: /*contributor*/ return new Property("contributor", "Reference(Practitioner|Device)", "Parties that may or should contribute or have contributed information to the adverse event, which can consist of one or more activities. Such information includes information leading to the decision to perform the activity and how to perform the activity (e.g. consultant), information that the activity itself seeks to reveal (e.g. informant of clinical history), or information about what activity was performed (e.g. informant witness).", 0, java.lang.Integer.MAX_VALUE, contributor);
case -1957422662: /*suspectEntity*/ return new Property("suspectEntity", "", "Describes the entity that is suspected to have caused the adverse event.", 0, java.lang.Integer.MAX_VALUE, suspectEntity);
case -1685245681: /*subjectMedicalHistory*/ return new Property("subjectMedicalHistory", "Reference(Condition|Observation|AllergyIntolerance|FamilyMemberHistory|Immunization|Procedure)", "AdverseEvent.subjectMedicalHistory.", 0, java.lang.Integer.MAX_VALUE, subjectMedicalHistory);
case -1685245681: /*subjectMedicalHistory*/ return new Property("subjectMedicalHistory", "Reference(Condition|Observation|AllergyIntolerance|FamilyMemberHistory|Immunization|Procedure|Media|DocumentReference)", "AdverseEvent.subjectMedicalHistory.", 0, java.lang.Integer.MAX_VALUE, subjectMedicalHistory);
case 1013971334: /*referenceDocument*/ return new Property("referenceDocument", "Reference(DocumentReference)", "AdverseEvent.referenceDocument.", 0, java.lang.Integer.MAX_VALUE, referenceDocument);
case 109776329: /*study*/ return new Property("study", "Reference(ResearchStudy)", "AdverseEvent.study.", 0, java.lang.Integer.MAX_VALUE, study);
default: return super.getNamedProperty(_hash, _name, _checkValid);
@ -1797,6 +1817,7 @@ public class AdverseEvent extends DomainResource {
case 50511102: /*category*/ return this.category == null ? new Base[0] : this.category.toArray(new Base[this.category.size()]); // CodeableConcept
case 96891546: /*event*/ return this.event == null ? new Base[0] : new Base[] {this.event}; // CodeableConcept
case -1867885268: /*subject*/ return this.subject == null ? new Base[0] : new Base[] {this.subject}; // Reference
case 951530927: /*context*/ return this.context == null ? new Base[0] : new Base[] {this.context}; // Reference
case 3076014: /*date*/ return this.date == null ? new Base[0] : new Base[] {this.date}; // DateTimeType
case -830261258: /*resultingCondition*/ return this.resultingCondition == null ? new Base[0] : this.resultingCondition.toArray(new Base[this.resultingCondition.size()]); // Reference
case 1901043637: /*location*/ return this.location == null ? new Base[0] : new Base[] {this.location}; // Reference
@ -1804,8 +1825,7 @@ public class AdverseEvent extends DomainResource {
case 1478300413: /*severity*/ return this.severity == null ? new Base[0] : new Base[] {this.severity}; // CodeableConcept
case -1106507950: /*outcome*/ return this.outcome == null ? new Base[0] : new Base[] {this.outcome}; // CodeableConcept
case -799233858: /*recorder*/ return this.recorder == null ? new Base[0] : new Base[] {this.recorder}; // Reference
case 270753849: /*eventParticipant*/ return this.eventParticipant == null ? new Base[0] : new Base[] {this.eventParticipant}; // Reference
case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // StringType
case -1895276325: /*contributor*/ return this.contributor == null ? new Base[0] : this.contributor.toArray(new Base[this.contributor.size()]); // Reference
case -1957422662: /*suspectEntity*/ return this.suspectEntity == null ? new Base[0] : this.suspectEntity.toArray(new Base[this.suspectEntity.size()]); // AdverseEventSuspectEntityComponent
case -1685245681: /*subjectMedicalHistory*/ return this.subjectMedicalHistory == null ? new Base[0] : this.subjectMedicalHistory.toArray(new Base[this.subjectMedicalHistory.size()]); // Reference
case 1013971334: /*referenceDocument*/ return this.referenceDocument == null ? new Base[0] : this.referenceDocument.toArray(new Base[this.referenceDocument.size()]); // Reference
@ -1834,6 +1854,9 @@ public class AdverseEvent extends DomainResource {
case -1867885268: // subject
this.subject = castToReference(value); // Reference
return value;
case 951530927: // context
this.context = castToReference(value); // Reference
return value;
case 3076014: // date
this.date = castToDateTime(value); // DateTimeType
return value;
@ -1855,11 +1878,8 @@ public class AdverseEvent extends DomainResource {
case -799233858: // recorder
this.recorder = castToReference(value); // Reference
return value;
case 270753849: // eventParticipant
this.eventParticipant = castToReference(value); // Reference
return value;
case -1724546052: // description
this.description = castToString(value); // StringType
case -1895276325: // contributor
this.getContributor().add(castToReference(value)); // Reference
return value;
case -1957422662: // suspectEntity
this.getSuspectEntity().add((AdverseEventSuspectEntityComponent) value); // AdverseEventSuspectEntityComponent
@ -1891,6 +1911,8 @@ public class AdverseEvent extends DomainResource {
this.event = castToCodeableConcept(value); // CodeableConcept
} else if (name.equals("subject")) {
this.subject = castToReference(value); // Reference
} else if (name.equals("context")) {
this.context = castToReference(value); // Reference
} else if (name.equals("date")) {
this.date = castToDateTime(value); // DateTimeType
} else if (name.equals("resultingCondition")) {
@ -1905,10 +1927,8 @@ public class AdverseEvent extends DomainResource {
this.outcome = castToCodeableConcept(value); // CodeableConcept
} else if (name.equals("recorder")) {
this.recorder = castToReference(value); // Reference
} else if (name.equals("eventParticipant")) {
this.eventParticipant = castToReference(value); // Reference
} else if (name.equals("description")) {
this.description = castToString(value); // StringType
} else if (name.equals("contributor")) {
this.getContributor().add(castToReference(value));
} else if (name.equals("suspectEntity")) {
this.getSuspectEntity().add((AdverseEventSuspectEntityComponent) value);
} else if (name.equals("subjectMedicalHistory")) {
@ -1930,6 +1950,7 @@ public class AdverseEvent extends DomainResource {
case 50511102: return addCategory();
case 96891546: return getEvent();
case -1867885268: return getSubject();
case 951530927: return getContext();
case 3076014: return getDateElement();
case -830261258: return addResultingCondition();
case 1901043637: return getLocation();
@ -1937,8 +1958,7 @@ public class AdverseEvent extends DomainResource {
case 1478300413: return getSeverity();
case -1106507950: return getOutcome();
case -799233858: return getRecorder();
case 270753849: return getEventParticipant();
case -1724546052: return getDescriptionElement();
case -1895276325: return addContributor();
case -1957422662: return addSuspectEntity();
case -1685245681: return addSubjectMedicalHistory();
case 1013971334: return addReferenceDocument();
@ -1956,6 +1976,7 @@ public class AdverseEvent extends DomainResource {
case 50511102: /*category*/ return new String[] {"CodeableConcept"};
case 96891546: /*event*/ return new String[] {"CodeableConcept"};
case -1867885268: /*subject*/ return new String[] {"Reference"};
case 951530927: /*context*/ return new String[] {"Reference"};
case 3076014: /*date*/ return new String[] {"dateTime"};
case -830261258: /*resultingCondition*/ return new String[] {"Reference"};
case 1901043637: /*location*/ return new String[] {"Reference"};
@ -1963,8 +1984,7 @@ public class AdverseEvent extends DomainResource {
case 1478300413: /*severity*/ return new String[] {"CodeableConcept"};
case -1106507950: /*outcome*/ return new String[] {"CodeableConcept"};
case -799233858: /*recorder*/ return new String[] {"Reference"};
case 270753849: /*eventParticipant*/ return new String[] {"Reference"};
case -1724546052: /*description*/ return new String[] {"string"};
case -1895276325: /*contributor*/ return new String[] {"Reference"};
case -1957422662: /*suspectEntity*/ return new String[] {};
case -1685245681: /*subjectMedicalHistory*/ return new String[] {"Reference"};
case 1013971334: /*referenceDocument*/ return new String[] {"Reference"};
@ -1994,6 +2014,10 @@ public class AdverseEvent extends DomainResource {
this.subject = new Reference();
return this.subject;
}
else if (name.equals("context")) {
this.context = new Reference();
return this.context;
}
else if (name.equals("date")) {
throw new FHIRException("Cannot call addChild on a primitive type AdverseEvent.date");
}
@ -2020,12 +2044,8 @@ public class AdverseEvent extends DomainResource {
this.recorder = new Reference();
return this.recorder;
}
else if (name.equals("eventParticipant")) {
this.eventParticipant = new Reference();
return this.eventParticipant;
}
else if (name.equals("description")) {
throw new FHIRException("Cannot call addChild on a primitive type AdverseEvent.description");
else if (name.equals("contributor")) {
return addContributor();
}
else if (name.equals("suspectEntity")) {
return addSuspectEntity();
@ -2060,6 +2080,7 @@ public class AdverseEvent extends DomainResource {
};
dst.event = event == null ? null : event.copy();
dst.subject = subject == null ? null : subject.copy();
dst.context = context == null ? null : context.copy();
dst.date = date == null ? null : date.copy();
if (resultingCondition != null) {
dst.resultingCondition = new ArrayList<Reference>();
@ -2071,8 +2092,11 @@ public class AdverseEvent extends DomainResource {
dst.severity = severity == null ? null : severity.copy();
dst.outcome = outcome == null ? null : outcome.copy();
dst.recorder = recorder == null ? null : recorder.copy();
dst.eventParticipant = eventParticipant == null ? null : eventParticipant.copy();
dst.description = description == null ? null : description.copy();
if (contributor != null) {
dst.contributor = new ArrayList<Reference>();
for (Reference i : contributor)
dst.contributor.add(i.copy());
};
if (suspectEntity != null) {
dst.suspectEntity = new ArrayList<AdverseEventSuspectEntityComponent>();
for (AdverseEventSuspectEntityComponent i : suspectEntity)
@ -2109,12 +2133,12 @@ public class AdverseEvent extends DomainResource {
AdverseEvent o = (AdverseEvent) other_;
return compareDeep(identifier, o.identifier, true) && compareDeep(actuality, o.actuality, true)
&& compareDeep(category, o.category, true) && compareDeep(event, o.event, true) && compareDeep(subject, o.subject, true)
&& compareDeep(date, o.date, true) && compareDeep(resultingCondition, o.resultingCondition, true)
&& compareDeep(context, o.context, true) && compareDeep(date, o.date, true) && compareDeep(resultingCondition, o.resultingCondition, true)
&& compareDeep(location, o.location, true) && compareDeep(seriousness, o.seriousness, true) && compareDeep(severity, o.severity, true)
&& compareDeep(outcome, o.outcome, true) && compareDeep(recorder, o.recorder, true) && compareDeep(eventParticipant, o.eventParticipant, true)
&& compareDeep(description, o.description, true) && compareDeep(suspectEntity, o.suspectEntity, true)
&& compareDeep(subjectMedicalHistory, o.subjectMedicalHistory, true) && compareDeep(referenceDocument, o.referenceDocument, true)
&& compareDeep(study, o.study, true);
&& compareDeep(outcome, o.outcome, true) && compareDeep(recorder, o.recorder, true) && compareDeep(contributor, o.contributor, true)
&& compareDeep(suspectEntity, o.suspectEntity, true) && compareDeep(subjectMedicalHistory, o.subjectMedicalHistory, true)
&& compareDeep(referenceDocument, o.referenceDocument, true) && compareDeep(study, o.study, true)
;
}
@Override
@ -2124,14 +2148,13 @@ public class AdverseEvent extends DomainResource {
if (!(other_ instanceof AdverseEvent))
return false;
AdverseEvent o = (AdverseEvent) other_;
return compareValues(actuality, o.actuality, true) && compareValues(date, o.date, true) && compareValues(description, o.description, true)
;
return compareValues(actuality, o.actuality, true) && compareValues(date, o.date, true);
}
public boolean isEmpty() {
return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, actuality, category
, event, subject, date, resultingCondition, location, seriousness, severity, outcome
, recorder, eventParticipant, description, suspectEntity, subjectMedicalHistory, referenceDocument
, event, subject, context, date, resultingCondition, location, seriousness, severity
, outcome, recorder, contributor, suspectEntity, subjectMedicalHistory, referenceDocument
, study);
}
@ -2332,7 +2355,7 @@ public class AdverseEvent extends DomainResource {
* Path: <b>AdverseEvent.suspectEntity.instance</b><br>
* </p>
*/
@SearchParamDefinition(name="substance", path="AdverseEvent.suspectEntity.instance", description="Refers to the specific entity that caused the adverse event", type="reference", target={Device.class, Medication.class, MedicationAdministration.class, MedicationStatement.class, Substance.class } )
@SearchParamDefinition(name="substance", path="AdverseEvent.suspectEntity.instance", description="Refers to the specific entity that caused the adverse event", type="reference", target={Device.class, Immunization.class, Medication.class, MedicationAdministration.class, MedicationStatement.class, Procedure.class, Substance.class } )
public static final String SP_SUBSTANCE = "substance";
/**
* <b>Fluent Client</b> search parameter constant for <b>substance</b>

View File

@ -29,7 +29,7 @@ package org.hl7.fhir.r4.model;
*/
// Generated on Tue, Jan 9, 2018 14:51-0500 for FHIR v3.2.0
// Generated on Thu, Mar 1, 2018 20:26+1100 for FHIR v3.2.0
import java.util.*;

View File

@ -29,7 +29,7 @@ package org.hl7.fhir.r4.model;
*/
// Generated on Tue, Jan 9, 2018 14:51-0500 for FHIR v3.2.0
// Generated on Thu, Mar 1, 2018 20:26+1100 for FHIR v3.2.0
import java.util.*;
@ -1352,24 +1352,36 @@ public class AllergyIntolerance extends DomainResource {
*/
protected Patient patientTarget;
/**
* The encounter when the allergy or intolerance was asserted.
*/
@Child(name = "encounter", type = {Encounter.class}, order=8, min=0, max=1, modifier=false, summary=false)
@Description(shortDefinition="Encounter when the allergy or intolerance was asserted", formalDefinition="The encounter when the allergy or intolerance was asserted." )
protected Reference encounter;
/**
* The actual object that is the target of the reference (The encounter when the allergy or intolerance was asserted.)
*/
protected Encounter encounterTarget;
/**
* Estimated or actual date, date-time, or age when allergy or intolerance was identified.
*/
@Child(name = "onset", type = {DateTimeType.class, Age.class, Period.class, Range.class, StringType.class}, order=8, min=0, max=1, modifier=false, summary=false)
@Child(name = "onset", type = {DateTimeType.class, Age.class, Period.class, Range.class, StringType.class}, order=9, min=0, max=1, modifier=false, summary=false)
@Description(shortDefinition="When allergy or intolerance was identified", formalDefinition="Estimated or actual date, date-time, or age when allergy or intolerance was identified." )
protected Type onset;
/**
* The date on which the existance of the AllergyIntolerance was first asserted or acknowledged.
*/
@Child(name = "assertedDate", type = {DateTimeType.class}, order=9, min=0, max=1, modifier=false, summary=false)
@Child(name = "assertedDate", type = {DateTimeType.class}, order=10, min=0, max=1, modifier=false, summary=false)
@Description(shortDefinition="Date record was believed accurate", formalDefinition="The date on which the existance of the AllergyIntolerance was first asserted or acknowledged." )
protected DateTimeType assertedDate;
/**
* Individual who recorded the record and takes responsibility for its content.
*/
@Child(name = "recorder", type = {Practitioner.class, Patient.class, RelatedPerson.class}, order=10, min=0, max=1, modifier=false, summary=false)
@Child(name = "recorder", type = {Practitioner.class, Patient.class, RelatedPerson.class}, order=11, min=0, max=1, modifier=false, summary=false)
@Description(shortDefinition="Who recorded the sensitivity", formalDefinition="Individual who recorded the record and takes responsibility for its content." )
protected Reference recorder;
@ -1381,7 +1393,7 @@ public class AllergyIntolerance extends DomainResource {
/**
* The source of the information about the allergy that is recorded.
*/
@Child(name = "asserter", type = {Patient.class, RelatedPerson.class, Practitioner.class}, order=11, min=0, max=1, modifier=false, summary=true)
@Child(name = "asserter", type = {Patient.class, RelatedPerson.class, Practitioner.class}, order=12, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="Source of the information about the allergy", formalDefinition="The source of the information about the allergy that is recorded." )
protected Reference asserter;
@ -1393,25 +1405,25 @@ public class AllergyIntolerance extends DomainResource {
/**
* Represents the date and/or time of the last known occurrence of a reaction event.
*/
@Child(name = "lastOccurrence", type = {DateTimeType.class}, order=12, min=0, max=1, modifier=false, summary=false)
@Child(name = "lastOccurrence", type = {DateTimeType.class}, order=13, min=0, max=1, modifier=false, summary=false)
@Description(shortDefinition="Date(/time) of last known occurrence of a reaction", formalDefinition="Represents the date and/or time of the last known occurrence of a reaction event." )
protected DateTimeType lastOccurrence;
/**
* Additional narrative about the propensity for the Adverse Reaction, not captured in other fields.
*/
@Child(name = "note", type = {Annotation.class}, order=13, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
@Child(name = "note", type = {Annotation.class}, order=14, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
@Description(shortDefinition="Additional text not captured in other fields", formalDefinition="Additional narrative about the propensity for the Adverse Reaction, not captured in other fields." )
protected List<Annotation> note;
/**
* Details about each adverse reaction event linked to exposure to the identified substance.
*/
@Child(name = "reaction", type = {}, order=14, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
@Child(name = "reaction", type = {}, order=15, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
@Description(shortDefinition="Adverse Reaction Events linked to exposure to substance", formalDefinition="Details about each adverse reaction event linked to exposure to the identified substance." )
protected List<AllergyIntoleranceReactionComponent> reaction;
private static final long serialVersionUID = 948924623L;
private static final long serialVersionUID = 325449518L;
/**
* Constructor
@ -1806,6 +1818,50 @@ public class AllergyIntolerance extends DomainResource {
return this;
}
/**
* @return {@link #encounter} (The encounter when the allergy or intolerance was asserted.)
*/
public Reference getEncounter() {
if (this.encounter == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create AllergyIntolerance.encounter");
else if (Configuration.doAutoCreate())
this.encounter = new Reference(); // cc
return this.encounter;
}
public boolean hasEncounter() {
return this.encounter != null && !this.encounter.isEmpty();
}
/**
* @param value {@link #encounter} (The encounter when the allergy or intolerance was asserted.)
*/
public AllergyIntolerance setEncounter(Reference value) {
this.encounter = value;
return this;
}
/**
* @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 encounter when the allergy or intolerance was asserted.)
*/
public Encounter getEncounterTarget() {
if (this.encounterTarget == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create AllergyIntolerance.encounter");
else if (Configuration.doAutoCreate())
this.encounterTarget = new Encounter(); // aa
return this.encounterTarget;
}
/**
* @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 encounter when the allergy or intolerance was asserted.)
*/
public AllergyIntolerance setEncounterTarget(Encounter value) {
this.encounterTarget = value;
return this;
}
/**
* @return {@link #onset} (Estimated or actual date, date-time, or age when allergy or intolerance was identified.)
*/
@ -2182,6 +2238,7 @@ public class AllergyIntolerance extends DomainResource {
children.add(new Property("criticality", "code", "Estimate of the potential clinical harm, or seriousness, of the reaction to the identified substance.", 0, 1, criticality));
children.add(new Property("code", "CodeableConcept", "Code for an allergy or intolerance statement (either a positive or a negated/excluded statement). This may be a code for a substance or pharmaceutical product that is considered to be responsible for the adverse reaction risk (e.g., \"Latex\"), an allergy or intolerance condition (e.g., \"Latex allergy\"), or a negated/excluded code for a specific substance or class (e.g., \"No latex allergy\") or a general or categorical negated statement (e.g., \"No known allergy\", \"No known drug allergies\"). Note: the substance for a specific reaction may be different from the substance identified as the cause of the risk, but it must be consistent with it. For instance, it may be a more specific substance (e.g. a brand medication) or a composite product that includes the identified substance. It must be clinically safe to only process the 'code' and ignore the 'reaction.substance'. If a receiving system is unable to confirm that AllergyIntolerance.reaction.substance falls within the semantic scope of AllergyIntolerance.code, then the receiving system should ignore AllergyIntolerance.reaction.substance.", 0, 1, code));
children.add(new Property("patient", "Reference(Patient)", "The patient who has the allergy or intolerance.", 0, 1, patient));
children.add(new Property("encounter", "Reference(Encounter)", "The encounter when the allergy or intolerance was asserted.", 0, 1, encounter));
children.add(new Property("onset[x]", "dateTime|Age|Period|Range|string", "Estimated or actual date, date-time, or age when allergy or intolerance was identified.", 0, 1, onset));
children.add(new Property("assertedDate", "dateTime", "The date on which the existance of the AllergyIntolerance was first asserted or acknowledged.", 0, 1, assertedDate));
children.add(new Property("recorder", "Reference(Practitioner|Patient|RelatedPerson)", "Individual who recorded the record and takes responsibility for its content.", 0, 1, recorder));
@ -2202,6 +2259,7 @@ public class AllergyIntolerance extends DomainResource {
case -1608054609: /*criticality*/ return new Property("criticality", "code", "Estimate of the potential clinical harm, or seriousness, of the reaction to the identified substance.", 0, 1, criticality);
case 3059181: /*code*/ return new Property("code", "CodeableConcept", "Code for an allergy or intolerance statement (either a positive or a negated/excluded statement). This may be a code for a substance or pharmaceutical product that is considered to be responsible for the adverse reaction risk (e.g., \"Latex\"), an allergy or intolerance condition (e.g., \"Latex allergy\"), or a negated/excluded code for a specific substance or class (e.g., \"No latex allergy\") or a general or categorical negated statement (e.g., \"No known allergy\", \"No known drug allergies\"). Note: the substance for a specific reaction may be different from the substance identified as the cause of the risk, but it must be consistent with it. For instance, it may be a more specific substance (e.g. a brand medication) or a composite product that includes the identified substance. It must be clinically safe to only process the 'code' and ignore the 'reaction.substance'. If a receiving system is unable to confirm that AllergyIntolerance.reaction.substance falls within the semantic scope of AllergyIntolerance.code, then the receiving system should ignore AllergyIntolerance.reaction.substance.", 0, 1, code);
case -791418107: /*patient*/ return new Property("patient", "Reference(Patient)", "The patient who has the allergy or intolerance.", 0, 1, patient);
case 1524132147: /*encounter*/ return new Property("encounter", "Reference(Encounter)", "The encounter when the allergy or intolerance was asserted.", 0, 1, encounter);
case -1886216323: /*onset[x]*/ return new Property("onset[x]", "dateTime|Age|Period|Range|string", "Estimated or actual date, date-time, or age when allergy or intolerance was identified.", 0, 1, onset);
case 105901603: /*onset*/ return new Property("onset[x]", "dateTime|Age|Period|Range|string", "Estimated or actual date, date-time, or age when allergy or intolerance was identified.", 0, 1, onset);
case -1701663010: /*onsetDateTime*/ return new Property("onset[x]", "dateTime|Age|Period|Range|string", "Estimated or actual date, date-time, or age when allergy or intolerance was identified.", 0, 1, onset);
@ -2231,6 +2289,7 @@ public class AllergyIntolerance extends DomainResource {
case -1608054609: /*criticality*/ return this.criticality == null ? new Base[0] : new Base[] {this.criticality}; // Enumeration<AllergyIntoleranceCriticality>
case 3059181: /*code*/ return this.code == null ? new Base[0] : new Base[] {this.code}; // CodeableConcept
case -791418107: /*patient*/ return this.patient == null ? new Base[0] : new Base[] {this.patient}; // Reference
case 1524132147: /*encounter*/ return this.encounter == null ? new Base[0] : new Base[] {this.encounter}; // Reference
case 105901603: /*onset*/ return this.onset == null ? new Base[0] : new Base[] {this.onset}; // Type
case -174231629: /*assertedDate*/ return this.assertedDate == null ? new Base[0] : new Base[] {this.assertedDate}; // DateTimeType
case -799233858: /*recorder*/ return this.recorder == null ? new Base[0] : new Base[] {this.recorder}; // Reference
@ -2275,6 +2334,9 @@ public class AllergyIntolerance extends DomainResource {
case -791418107: // patient
this.patient = castToReference(value); // Reference
return value;
case 1524132147: // encounter
this.encounter = castToReference(value); // Reference
return value;
case 105901603: // onset
this.onset = castToType(value); // Type
return value;
@ -2324,6 +2386,8 @@ public class AllergyIntolerance extends DomainResource {
this.code = castToCodeableConcept(value); // CodeableConcept
} else if (name.equals("patient")) {
this.patient = castToReference(value); // Reference
} else if (name.equals("encounter")) {
this.encounter = castToReference(value); // Reference
} else if (name.equals("onset[x]")) {
this.onset = castToType(value); // Type
} else if (name.equals("assertedDate")) {
@ -2354,6 +2418,7 @@ public class AllergyIntolerance extends DomainResource {
case -1608054609: return getCriticalityElement();
case 3059181: return getCode();
case -791418107: return getPatient();
case 1524132147: return getEncounter();
case -1886216323: return getOnset();
case 105901603: return getOnset();
case -174231629: return getAssertedDateElement();
@ -2378,6 +2443,7 @@ public class AllergyIntolerance extends DomainResource {
case -1608054609: /*criticality*/ return new String[] {"code"};
case 3059181: /*code*/ return new String[] {"CodeableConcept"};
case -791418107: /*patient*/ return new String[] {"Reference"};
case 1524132147: /*encounter*/ return new String[] {"Reference"};
case 105901603: /*onset*/ return new String[] {"dateTime", "Age", "Period", "Range", "string"};
case -174231629: /*assertedDate*/ return new String[] {"dateTime"};
case -799233858: /*recorder*/ return new String[] {"Reference"};
@ -2418,6 +2484,10 @@ public class AllergyIntolerance extends DomainResource {
this.patient = new Reference();
return this.patient;
}
else if (name.equals("encounter")) {
this.encounter = new Reference();
return this.encounter;
}
else if (name.equals("onsetDateTime")) {
this.onset = new DateTimeType();
return this.onset;
@ -2486,6 +2556,7 @@ public class AllergyIntolerance extends DomainResource {
dst.criticality = criticality == null ? null : criticality.copy();
dst.code = code == null ? null : code.copy();
dst.patient = patient == null ? null : patient.copy();
dst.encounter = encounter == null ? null : encounter.copy();
dst.onset = onset == null ? null : onset.copy();
dst.assertedDate = assertedDate == null ? null : assertedDate.copy();
dst.recorder = recorder == null ? null : recorder.copy();
@ -2518,9 +2589,10 @@ public class AllergyIntolerance extends DomainResource {
return compareDeep(identifier, o.identifier, true) && compareDeep(clinicalStatus, o.clinicalStatus, true)
&& compareDeep(verificationStatus, o.verificationStatus, true) && compareDeep(type, o.type, true)
&& compareDeep(category, o.category, true) && compareDeep(criticality, o.criticality, true) && compareDeep(code, o.code, true)
&& compareDeep(patient, o.patient, true) && compareDeep(onset, o.onset, true) && compareDeep(assertedDate, o.assertedDate, true)
&& compareDeep(recorder, o.recorder, true) && compareDeep(asserter, o.asserter, true) && compareDeep(lastOccurrence, o.lastOccurrence, true)
&& compareDeep(note, o.note, true) && compareDeep(reaction, o.reaction, true);
&& compareDeep(patient, o.patient, true) && compareDeep(encounter, o.encounter, true) && compareDeep(onset, o.onset, true)
&& compareDeep(assertedDate, o.assertedDate, true) && compareDeep(recorder, o.recorder, true) && compareDeep(asserter, o.asserter, true)
&& compareDeep(lastOccurrence, o.lastOccurrence, true) && compareDeep(note, o.note, true) && compareDeep(reaction, o.reaction, true)
;
}
@Override
@ -2538,8 +2610,8 @@ public class AllergyIntolerance extends DomainResource {
public boolean isEmpty() {
return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, clinicalStatus
, verificationStatus, type, category, criticality, code, patient, onset, assertedDate
, recorder, asserter, lastOccurrence, note, reaction);
, verificationStatus, type, category, criticality, code, patient, encounter, onset
, assertedDate, recorder, asserter, lastOccurrence, note, reaction);
}
@Override

View File

@ -29,7 +29,7 @@ package org.hl7.fhir.r4.model;
*/
// Generated on Tue, Jan 9, 2018 14:51-0500 for FHIR v3.2.0
// Generated on Thu, Mar 1, 2018 20:26+1100 for FHIR v3.2.0
import java.util.*;

View File

@ -29,7 +29,7 @@ package org.hl7.fhir.r4.model;
*/
// Generated on Tue, Jan 9, 2018 14:51-0500 for FHIR v3.2.0
// Generated on Thu, Mar 1, 2018 20:26+1100 for FHIR v3.2.0
import java.util.*;
@ -62,7 +62,7 @@ public class Appointment extends DomainResource {
*/
BOOKED,
/**
* Some of the patients have arrived.
* The patient/patients has/have arrived and is/are waiting to be seen
*/
ARRIVED,
/**
@ -81,6 +81,10 @@ public class Appointment extends DomainResource {
* This instance should not have been part of this patient's medical record.
*/
ENTEREDINERROR,
/**
* When checked in, all pre-encounter administrative work is complete, and the encounter may begin. (where multiple patients are involved, they are all present)
*/
CHECKEDIN,
/**
* added to help the parsers with the generic types
*/
@ -104,6 +108,8 @@ public class Appointment extends DomainResource {
return NOSHOW;
if ("entered-in-error".equals(codeString))
return ENTEREDINERROR;
if ("checked-in".equals(codeString))
return CHECKEDIN;
if (Configuration.isAcceptInvalidEnums())
return null;
else
@ -119,6 +125,7 @@ public class Appointment extends DomainResource {
case CANCELLED: return "cancelled";
case NOSHOW: return "noshow";
case ENTEREDINERROR: return "entered-in-error";
case CHECKEDIN: return "checked-in";
default: return "?";
}
}
@ -132,6 +139,7 @@ public class Appointment extends DomainResource {
case CANCELLED: return "http://hl7.org/fhir/appointmentstatus";
case NOSHOW: return "http://hl7.org/fhir/appointmentstatus";
case ENTEREDINERROR: return "http://hl7.org/fhir/appointmentstatus";
case CHECKEDIN: return "http://hl7.org/fhir/appointmentstatus";
default: return "?";
}
}
@ -140,11 +148,12 @@ public class Appointment extends DomainResource {
case PROPOSED: return "None of the participant(s) have finalized their acceptance of the appointment request, and the start/end time might not be set yet.";
case PENDING: return "Some or all of the participant(s) have not finalized their acceptance of the appointment request.";
case BOOKED: return "All participant(s) have been considered and the appointment is confirmed to go ahead at the date/times specified.";
case ARRIVED: return "Some of the patients have arrived.";
case ARRIVED: return "The patient/patients has/have arrived and is/are waiting to be seen";
case FULFILLED: return "This appointment has completed and may have resulted in an encounter.";
case CANCELLED: return "The appointment has been cancelled.";
case NOSHOW: return "Some or all of the participant(s) have not/did not appear for the appointment (usually the patient).";
case ENTEREDINERROR: return "This instance should not have been part of this patient's medical record.";
case CHECKEDIN: return "When checked in, all pre-encounter administrative work is complete, and the encounter may begin. (where multiple patients are involved, they are all present)";
default: return "?";
}
}
@ -158,6 +167,7 @@ public class Appointment extends DomainResource {
case CANCELLED: return "Cancelled";
case NOSHOW: return "No Show";
case ENTEREDINERROR: return "Entered in error";
case CHECKEDIN: return "Checked In";
default: return "?";
}
}
@ -184,6 +194,8 @@ public class Appointment extends DomainResource {
return AppointmentStatus.NOSHOW;
if ("entered-in-error".equals(codeString))
return AppointmentStatus.ENTEREDINERROR;
if ("checked-in".equals(codeString))
return AppointmentStatus.CHECKEDIN;
throw new IllegalArgumentException("Unknown AppointmentStatus code '"+codeString+"'");
}
public Enumeration<AppointmentStatus> fromType(Base code) throws FHIRException {
@ -210,6 +222,8 @@ public class Appointment extends DomainResource {
return new Enumeration<AppointmentStatus>(this, AppointmentStatus.NOSHOW);
if ("entered-in-error".equals(codeString))
return new Enumeration<AppointmentStatus>(this, AppointmentStatus.ENTEREDINERROR);
if ("checked-in".equals(codeString))
return new Enumeration<AppointmentStatus>(this, AppointmentStatus.CHECKEDIN);
throw new FHIRException("Unknown AppointmentStatus code '"+codeString+"'");
}
public String toCode(AppointmentStatus code) {
@ -229,6 +243,8 @@ public class Appointment extends DomainResource {
return "noshow";
if (code == AppointmentStatus.ENTEREDINERROR)
return "entered-in-error";
if (code == AppointmentStatus.CHECKEDIN)
return "checked-in";
return "?";
}
public String toSystem(AppointmentStatus code) {
@ -506,7 +522,14 @@ public class Appointment extends DomainResource {
@ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/participationstatus")
protected Enumeration<ParticipationStatus> status;
private static final long serialVersionUID = -1620552507L;
/**
* Participation period of the actor.
*/
@Child(name = "period", type = {Period.class}, order=5, min=0, max=1, modifier=false, summary=false)
@Description(shortDefinition="Participation period of the actor", formalDefinition="Participation period of the actor." )
protected Period period;
private static final long serialVersionUID = -1939292177L;
/**
* Constructor
@ -709,12 +732,37 @@ public class Appointment extends DomainResource {
return this;
}
/**
* @return {@link #period} (Participation period of the actor.)
*/
public Period getPeriod() {
if (this.period == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create AppointmentParticipantComponent.period");
else if (Configuration.doAutoCreate())
this.period = new Period(); // cc
return this.period;
}
public boolean hasPeriod() {
return this.period != null && !this.period.isEmpty();
}
/**
* @param value {@link #period} (Participation period of the actor.)
*/
public AppointmentParticipantComponent setPeriod(Period value) {
this.period = value;
return this;
}
protected void listChildren(List<Property> children) {
super.listChildren(children);
children.add(new Property("type", "CodeableConcept", "Role of participant in the appointment.", 0, java.lang.Integer.MAX_VALUE, type));
children.add(new Property("actor", "Reference(Patient|Practitioner|RelatedPerson|Device|HealthcareService|Location)", "A Person, Location/HealthcareService or Device that is participating in the appointment.", 0, 1, actor));
children.add(new Property("required", "code", "Is this participant required to be present at the meeting. This covers a use-case where 2 doctors need to meet to discuss the results for a specific patient, and the patient is not required to be present.", 0, 1, required));
children.add(new Property("status", "code", "Participation status of the actor.", 0, 1, status));
children.add(new Property("period", "Period", "Participation period of the actor.", 0, 1, period));
}
@Override
@ -724,6 +772,7 @@ public class Appointment extends DomainResource {
case 92645877: /*actor*/ return new Property("actor", "Reference(Patient|Practitioner|RelatedPerson|Device|HealthcareService|Location)", "A Person, Location/HealthcareService or Device that is participating in the appointment.", 0, 1, actor);
case -393139297: /*required*/ return new Property("required", "code", "Is this participant required to be present at the meeting. This covers a use-case where 2 doctors need to meet to discuss the results for a specific patient, and the patient is not required to be present.", 0, 1, required);
case -892481550: /*status*/ return new Property("status", "code", "Participation status of the actor.", 0, 1, status);
case -991726143: /*period*/ return new Property("period", "Period", "Participation period of the actor.", 0, 1, period);
default: return super.getNamedProperty(_hash, _name, _checkValid);
}
@ -736,6 +785,7 @@ public class Appointment extends DomainResource {
case 92645877: /*actor*/ return this.actor == null ? new Base[0] : new Base[] {this.actor}; // Reference
case -393139297: /*required*/ return this.required == null ? new Base[0] : new Base[] {this.required}; // Enumeration<ParticipantRequired>
case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<ParticipationStatus>
case -991726143: /*period*/ return this.period == null ? new Base[0] : new Base[] {this.period}; // Period
default: return super.getProperty(hash, name, checkValid);
}
@ -758,6 +808,9 @@ public class Appointment extends DomainResource {
value = new ParticipationStatusEnumFactory().fromType(castToCode(value));
this.status = (Enumeration) value; // Enumeration<ParticipationStatus>
return value;
case -991726143: // period
this.period = castToPeriod(value); // Period
return value;
default: return super.setProperty(hash, name, value);
}
@ -775,6 +828,8 @@ public class Appointment extends DomainResource {
} else if (name.equals("status")) {
value = new ParticipationStatusEnumFactory().fromType(castToCode(value));
this.status = (Enumeration) value; // Enumeration<ParticipationStatus>
} else if (name.equals("period")) {
this.period = castToPeriod(value); // Period
} else
return super.setProperty(name, value);
return value;
@ -787,6 +842,7 @@ public class Appointment extends DomainResource {
case 92645877: return getActor();
case -393139297: return getRequiredElement();
case -892481550: return getStatusElement();
case -991726143: return getPeriod();
default: return super.makeProperty(hash, name);
}
@ -799,6 +855,7 @@ public class Appointment extends DomainResource {
case 92645877: /*actor*/ return new String[] {"Reference"};
case -393139297: /*required*/ return new String[] {"code"};
case -892481550: /*status*/ return new String[] {"code"};
case -991726143: /*period*/ return new String[] {"Period"};
default: return super.getTypesForProperty(hash, name);
}
@ -819,6 +876,10 @@ public class Appointment extends DomainResource {
else if (name.equals("status")) {
throw new FHIRException("Cannot call addChild on a primitive type Appointment.status");
}
else if (name.equals("period")) {
this.period = new Period();
return this.period;
}
else
return super.addChild(name);
}
@ -834,6 +895,7 @@ public class Appointment extends DomainResource {
dst.actor = actor == null ? null : actor.copy();
dst.required = required == null ? null : required.copy();
dst.status = status == null ? null : status.copy();
dst.period = period == null ? null : period.copy();
return dst;
}
@ -845,7 +907,7 @@ public class Appointment extends DomainResource {
return false;
AppointmentParticipantComponent o = (AppointmentParticipantComponent) other_;
return compareDeep(type, o.type, true) && compareDeep(actor, o.actor, true) && compareDeep(required, o.required, true)
&& compareDeep(status, o.status, true);
&& compareDeep(status, o.status, true) && compareDeep(period, o.period, true);
}
@Override
@ -860,7 +922,7 @@ public class Appointment extends DomainResource {
public boolean isEmpty() {
return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, actor, required, status
);
, period);
}
public String fhirType() {
@ -881,17 +943,17 @@ public class Appointment extends DomainResource {
* The overall status of the Appointment. Each of the participants has their own participation status which indicates their involvement in the process, however this status indicates the shared status.
*/
@Child(name = "status", type = {CodeType.class}, order=1, min=1, max=1, modifier=true, summary=true)
@Description(shortDefinition="proposed | pending | booked | arrived | fulfilled | cancelled | noshow | entered-in-error", formalDefinition="The overall status of the Appointment. Each of the participants has their own participation status which indicates their involvement in the process, however this status indicates the shared status." )
@Description(shortDefinition="proposed | pending | booked | arrived | fulfilled | cancelled | noshow | entered-in-error | checked-in", formalDefinition="The overall status of the Appointment. Each of the participants has their own participation status which indicates their involvement in the process, however this status indicates the shared status." )
@ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/appointmentstatus")
protected Enumeration<AppointmentStatus> status;
/**
* A broad categorisation of the service that is to be performed during this appointment.
*/
@Child(name = "serviceCategory", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=true)
@Child(name = "serviceCategory", type = {CodeableConcept.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
@Description(shortDefinition="A broad categorisation of the service that is to be performed during this appointment", formalDefinition="A broad categorisation of the service that is to be performed during this appointment." )
@ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-category")
protected CodeableConcept serviceCategory;
protected List<CodeableConcept> serviceCategory;
/**
* The specific service that is to be performed during this appointment.
@ -978,10 +1040,10 @@ public class Appointment extends DomainResource {
protected InstantType end;
/**
* Number of minutes that the appointment is to take. This can be less than the duration between the start and end times (where actual time of appointment is only an estimate or is a planned appointment request).
* Number of minutes that the appointment is to take. This can be less than the duration between the start and end times. For example, where the actual time of appointment is only an estimate or if a 30 minute appointment is being requested, but any time would work. Also, if there is, for example, a planned 15 minute break in the middle of a long appointment, the duration may be 15 minutes less than the difference between the start and end.
*/
@Child(name = "minutesDuration", type = {PositiveIntType.class}, order=13, min=0, max=1, modifier=false, summary=false)
@Description(shortDefinition="Can be less than start/end (e.g. estimate)", formalDefinition="Number of minutes that the appointment is to take. This can be less than the duration between the start and end times (where actual time of appointment is only an estimate or is a planned appointment request)." )
@Description(shortDefinition="Can be less than start/end (e.g. estimate)", formalDefinition="Number of minutes that the appointment is to take. This can be less than the duration between the start and end times. For example, where the actual time of appointment is only an estimate or if a 30 minute appointment is being requested, but any time would work. Also, if there is, for example, a planned 15 minute break in the middle of a long appointment, the duration may be 15 minutes less than the difference between the start and end." )
protected PositiveIntType minutesDuration;
/**
@ -1020,13 +1082,13 @@ public class Appointment extends DomainResource {
/**
* The referral request this appointment is allocated to assess (incoming referral).
*/
@Child(name = "incomingReferral", type = {ServiceRequest.class}, order=18, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
@Child(name = "basedOn", type = {ServiceRequest.class}, order=18, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
@Description(shortDefinition="The ServiceRequest provided as information to allocate to the Encounter", formalDefinition="The referral request this appointment is allocated to assess (incoming referral)." )
protected List<Reference> incomingReferral;
protected List<Reference> basedOn;
/**
* The actual objects that are the target of the reference (The referral request this appointment is allocated to assess (incoming referral).)
*/
protected List<ServiceRequest> incomingReferralTarget;
protected List<ServiceRequest> basedOnTarget;
/**
@ -1043,7 +1105,7 @@ public class Appointment extends DomainResource {
@Description(shortDefinition="Potential date/time interval(s) requested to allocate the appointment within", formalDefinition="A set of date ranges (potentially including times) that the appointment is preferred to be scheduled within. When using these values, the minutes duration should be provided to indicate the length of the appointment to fill and populate the start/end times for the actual allocated time." )
protected List<Period> requestedPeriod;
private static final long serialVersionUID = 456556614L;
private static final long serialVersionUID = -128096826L;
/**
* Constructor
@ -1161,25 +1223,54 @@ public class Appointment extends DomainResource {
/**
* @return {@link #serviceCategory} (A broad categorisation of the service that is to be performed during this appointment.)
*/
public CodeableConcept getServiceCategory() {
public List<CodeableConcept> getServiceCategory() {
if (this.serviceCategory == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create Appointment.serviceCategory");
else if (Configuration.doAutoCreate())
this.serviceCategory = new CodeableConcept(); // cc
this.serviceCategory = new ArrayList<CodeableConcept>();
return this.serviceCategory;
}
/**
* @return Returns a reference to <code>this</code> for easy method chaining
*/
public Appointment setServiceCategory(List<CodeableConcept> theServiceCategory) {
this.serviceCategory = theServiceCategory;
return this;
}
public boolean hasServiceCategory() {
return this.serviceCategory != null && !this.serviceCategory.isEmpty();
if (this.serviceCategory == null)
return false;
for (CodeableConcept item : this.serviceCategory)
if (!item.isEmpty())
return true;
return false;
}
public CodeableConcept addServiceCategory() { //3
CodeableConcept t = new CodeableConcept();
if (this.serviceCategory == null)
this.serviceCategory = new ArrayList<CodeableConcept>();
this.serviceCategory.add(t);
return t;
}
public Appointment addServiceCategory(CodeableConcept t) { //3
if (t == null)
return this;
if (this.serviceCategory == null)
this.serviceCategory = new ArrayList<CodeableConcept>();
this.serviceCategory.add(t);
return this;
}
/**
* @param value {@link #serviceCategory} (A broad categorisation of the service that is to be performed during this appointment.)
* @return The first repetition of repeating field {@link #serviceCategory}, creating it if it does not already exist
*/
public Appointment setServiceCategory(CodeableConcept value) {
this.serviceCategory = value;
return this;
public CodeableConcept getServiceCategoryFirstRep() {
if (getServiceCategory().isEmpty()) {
addServiceCategory();
}
return getServiceCategory().get(0);
}
/**
@ -1684,7 +1775,7 @@ public class Appointment extends DomainResource {
}
/**
* @return {@link #minutesDuration} (Number of minutes that the appointment is to take. This can be less than the duration between the start and end times (where actual time of appointment is only an estimate or is a planned appointment request).). This is the underlying object with id, value and extensions. The accessor "getMinutesDuration" gives direct access to the value
* @return {@link #minutesDuration} (Number of minutes that the appointment is to take. This can be less than the duration between the start and end times. For example, where the actual time of appointment is only an estimate or if a 30 minute appointment is being requested, but any time would work. Also, if there is, for example, a planned 15 minute break in the middle of a long appointment, the duration may be 15 minutes less than the difference between the start and end.). This is the underlying object with id, value and extensions. The accessor "getMinutesDuration" gives direct access to the value
*/
public PositiveIntType getMinutesDurationElement() {
if (this.minutesDuration == null)
@ -1704,7 +1795,7 @@ public class Appointment extends DomainResource {
}
/**
* @param value {@link #minutesDuration} (Number of minutes that the appointment is to take. This can be less than the duration between the start and end times (where actual time of appointment is only an estimate or is a planned appointment request).). This is the underlying object with id, value and extensions. The accessor "getMinutesDuration" gives direct access to the value
* @param value {@link #minutesDuration} (Number of minutes that the appointment is to take. This can be less than the duration between the start and end times. For example, where the actual time of appointment is only an estimate or if a 30 minute appointment is being requested, but any time would work. Also, if there is, for example, a planned 15 minute break in the middle of a long appointment, the duration may be 15 minutes less than the difference between the start and end.). This is the underlying object with id, value and extensions. The accessor "getMinutesDuration" gives direct access to the value
*/
public Appointment setMinutesDurationElement(PositiveIntType value) {
this.minutesDuration = value;
@ -1712,14 +1803,14 @@ public class Appointment extends DomainResource {
}
/**
* @return Number of minutes that the appointment is to take. This can be less than the duration between the start and end times (where actual time of appointment is only an estimate or is a planned appointment request).
* @return Number of minutes that the appointment is to take. This can be less than the duration between the start and end times. For example, where the actual time of appointment is only an estimate or if a 30 minute appointment is being requested, but any time would work. Also, if there is, for example, a planned 15 minute break in the middle of a long appointment, the duration may be 15 minutes less than the difference between the start and end.
*/
public int getMinutesDuration() {
return this.minutesDuration == null || this.minutesDuration.isEmpty() ? 0 : this.minutesDuration.getValue();
}
/**
* @param value Number of minutes that the appointment is to take. This can be less than the duration between the start and end times (where actual time of appointment is only an estimate or is a planned appointment request).
* @param value Number of minutes that the appointment is to take. This can be less than the duration between the start and end times. For example, where the actual time of appointment is only an estimate or if a 30 minute appointment is being requested, but any time would work. Also, if there is, for example, a planned 15 minute break in the middle of a long appointment, the duration may be 15 minutes less than the difference between the start and end.
*/
public Appointment setMinutesDuration(int value) {
if (this.minutesDuration == null)
@ -1951,77 +2042,77 @@ public class Appointment extends DomainResource {
}
/**
* @return {@link #incomingReferral} (The referral request this appointment is allocated to assess (incoming referral).)
* @return {@link #basedOn} (The referral request this appointment is allocated to assess (incoming referral).)
*/
public List<Reference> getIncomingReferral() {
if (this.incomingReferral == null)
this.incomingReferral = new ArrayList<Reference>();
return this.incomingReferral;
public List<Reference> getBasedOn() {
if (this.basedOn == null)
this.basedOn = new ArrayList<Reference>();
return this.basedOn;
}
/**
* @return Returns a reference to <code>this</code> for easy method chaining
*/
public Appointment setIncomingReferral(List<Reference> theIncomingReferral) {
this.incomingReferral = theIncomingReferral;
public Appointment setBasedOn(List<Reference> theBasedOn) {
this.basedOn = theBasedOn;
return this;
}
public boolean hasIncomingReferral() {
if (this.incomingReferral == null)
public boolean hasBasedOn() {
if (this.basedOn == null)
return false;
for (Reference item : this.incomingReferral)
for (Reference item : this.basedOn)
if (!item.isEmpty())
return true;
return false;
}
public Reference addIncomingReferral() { //3
public Reference addBasedOn() { //3
Reference t = new Reference();
if (this.incomingReferral == null)
this.incomingReferral = new ArrayList<Reference>();
this.incomingReferral.add(t);
if (this.basedOn == null)
this.basedOn = new ArrayList<Reference>();
this.basedOn.add(t);
return t;
}
public Appointment addIncomingReferral(Reference t) { //3
public Appointment addBasedOn(Reference t) { //3
if (t == null)
return this;
if (this.incomingReferral == null)
this.incomingReferral = new ArrayList<Reference>();
this.incomingReferral.add(t);
if (this.basedOn == null)
this.basedOn = new ArrayList<Reference>();
this.basedOn.add(t);
return this;
}
/**
* @return The first repetition of repeating field {@link #incomingReferral}, creating it if it does not already exist
* @return The first repetition of repeating field {@link #basedOn}, creating it if it does not already exist
*/
public Reference getIncomingReferralFirstRep() {
if (getIncomingReferral().isEmpty()) {
addIncomingReferral();
public Reference getBasedOnFirstRep() {
if (getBasedOn().isEmpty()) {
addBasedOn();
}
return getIncomingReferral().get(0);
return getBasedOn().get(0);
}
/**
* @deprecated Use Reference#setResource(IBaseResource) instead
*/
@Deprecated
public List<ServiceRequest> getIncomingReferralTarget() {
if (this.incomingReferralTarget == null)
this.incomingReferralTarget = new ArrayList<ServiceRequest>();
return this.incomingReferralTarget;
public List<ServiceRequest> getBasedOnTarget() {
if (this.basedOnTarget == null)
this.basedOnTarget = new ArrayList<ServiceRequest>();
return this.basedOnTarget;
}
/**
* @deprecated Use Reference#setResource(IBaseResource) instead
*/
@Deprecated
public ServiceRequest addIncomingReferralTarget() {
public ServiceRequest addBasedOnTarget() {
ServiceRequest r = new ServiceRequest();
if (this.incomingReferralTarget == null)
this.incomingReferralTarget = new ArrayList<ServiceRequest>();
this.incomingReferralTarget.add(r);
if (this.basedOnTarget == null)
this.basedOnTarget = new ArrayList<ServiceRequest>();
this.basedOnTarget.add(r);
return r;
}
@ -2135,7 +2226,7 @@ public class Appointment extends DomainResource {
super.listChildren(children);
children.add(new Property("identifier", "Identifier", "This records identifiers associated with this appointment concern that are defined by business processes and/or used to refer to it when a direct URL reference to the resource itself is not appropriate (e.g. in CDA documents, or in written / printed documentation).", 0, java.lang.Integer.MAX_VALUE, identifier));
children.add(new Property("status", "code", "The overall status of the Appointment. Each of the participants has their own participation status which indicates their involvement in the process, however this status indicates the shared status.", 0, 1, status));
children.add(new Property("serviceCategory", "CodeableConcept", "A broad categorisation of the service that is to be performed during this appointment.", 0, 1, serviceCategory));
children.add(new Property("serviceCategory", "CodeableConcept", "A broad categorisation of the service that is to be performed during this appointment.", 0, java.lang.Integer.MAX_VALUE, serviceCategory));
children.add(new Property("serviceType", "CodeableConcept", "The specific service that is to be performed during this appointment.", 0, java.lang.Integer.MAX_VALUE, serviceType));
children.add(new Property("specialty", "CodeableConcept", "The specialty of a practitioner that would be required to perform the service requested in this appointment.", 0, java.lang.Integer.MAX_VALUE, specialty));
children.add(new Property("appointmentType", "CodeableConcept", "The style of appointment or patient that has been booked in the slot (not service type).", 0, 1, appointmentType));
@ -2146,12 +2237,12 @@ public class Appointment extends DomainResource {
children.add(new Property("supportingInformation", "Reference(Any)", "Additional information to support the appointment provided when making the appointment.", 0, java.lang.Integer.MAX_VALUE, supportingInformation));
children.add(new Property("start", "instant", "Date/Time that the appointment is to take place.", 0, 1, start));
children.add(new Property("end", "instant", "Date/Time that the appointment is to conclude.", 0, 1, end));
children.add(new Property("minutesDuration", "positiveInt", "Number of minutes that the appointment is to take. This can be less than the duration between the start and end times (where actual time of appointment is only an estimate or is a planned appointment request).", 0, 1, minutesDuration));
children.add(new Property("minutesDuration", "positiveInt", "Number of minutes that the appointment is to take. This can be less than the duration between the start and end times. For example, where the actual time of appointment is only an estimate or if a 30 minute appointment is being requested, but any time would work. Also, if there is, for example, a planned 15 minute break in the middle of a long appointment, the duration may be 15 minutes less than the difference between the start and end.", 0, 1, minutesDuration));
children.add(new Property("slot", "Reference(Slot)", "The slots from the participants' schedules that will be filled by the appointment.", 0, java.lang.Integer.MAX_VALUE, slot));
children.add(new Property("created", "dateTime", "The date that this appointment was initially created. This could be different to the meta.lastModified value on the initial entry, as this could have been before the resource was created on the FHIR server, and should remain unchanged over the lifespan of the appointment.", 0, 1, created));
children.add(new Property("comment", "string", "Additional comments about the appointment.", 0, 1, comment));
children.add(new Property("patientInstruction", "string", "While Appointment.comment contains information for internal use, Appointment.patientInstructions is used to capture patient facing information about the Appointment (e.g. please bring your referral or fast from 8pm night before).", 0, 1, patientInstruction));
children.add(new Property("incomingReferral", "Reference(ServiceRequest)", "The referral request this appointment is allocated to assess (incoming referral).", 0, java.lang.Integer.MAX_VALUE, incomingReferral));
children.add(new Property("basedOn", "Reference(ServiceRequest)", "The referral request this appointment is allocated to assess (incoming referral).", 0, java.lang.Integer.MAX_VALUE, basedOn));
children.add(new Property("participant", "", "List of participants involved in the appointment.", 0, java.lang.Integer.MAX_VALUE, participant));
children.add(new Property("requestedPeriod", "Period", "A set of date ranges (potentially including times) that the appointment is preferred to be scheduled within. When using these values, the minutes duration should be provided to indicate the length of the appointment to fill and populate the start/end times for the actual allocated time.", 0, java.lang.Integer.MAX_VALUE, requestedPeriod));
}
@ -2161,7 +2252,7 @@ public class Appointment extends DomainResource {
switch (_hash) {
case -1618432855: /*identifier*/ return new Property("identifier", "Identifier", "This records identifiers associated with this appointment concern that are defined by business processes and/or used to refer to it when a direct URL reference to the resource itself is not appropriate (e.g. in CDA documents, or in written / printed documentation).", 0, java.lang.Integer.MAX_VALUE, identifier);
case -892481550: /*status*/ return new Property("status", "code", "The overall status of the Appointment. Each of the participants has their own participation status which indicates their involvement in the process, however this status indicates the shared status.", 0, 1, status);
case 1281188563: /*serviceCategory*/ return new Property("serviceCategory", "CodeableConcept", "A broad categorisation of the service that is to be performed during this appointment.", 0, 1, serviceCategory);
case 1281188563: /*serviceCategory*/ return new Property("serviceCategory", "CodeableConcept", "A broad categorisation of the service that is to be performed during this appointment.", 0, java.lang.Integer.MAX_VALUE, serviceCategory);
case -1928370289: /*serviceType*/ return new Property("serviceType", "CodeableConcept", "The specific service that is to be performed during this appointment.", 0, java.lang.Integer.MAX_VALUE, serviceType);
case -1694759682: /*specialty*/ return new Property("specialty", "CodeableConcept", "The specialty of a practitioner that would be required to perform the service requested in this appointment.", 0, java.lang.Integer.MAX_VALUE, specialty);
case -1596426375: /*appointmentType*/ return new Property("appointmentType", "CodeableConcept", "The style of appointment or patient that has been booked in the slot (not service type).", 0, 1, appointmentType);
@ -2172,12 +2263,12 @@ public class Appointment extends DomainResource {
case -1248768647: /*supportingInformation*/ return new Property("supportingInformation", "Reference(Any)", "Additional information to support the appointment provided when making the appointment.", 0, java.lang.Integer.MAX_VALUE, supportingInformation);
case 109757538: /*start*/ return new Property("start", "instant", "Date/Time that the appointment is to take place.", 0, 1, start);
case 100571: /*end*/ return new Property("end", "instant", "Date/Time that the appointment is to conclude.", 0, 1, end);
case -413630573: /*minutesDuration*/ return new Property("minutesDuration", "positiveInt", "Number of minutes that the appointment is to take. This can be less than the duration between the start and end times (where actual time of appointment is only an estimate or is a planned appointment request).", 0, 1, minutesDuration);
case -413630573: /*minutesDuration*/ return new Property("minutesDuration", "positiveInt", "Number of minutes that the appointment is to take. This can be less than the duration between the start and end times. For example, where the actual time of appointment is only an estimate or if a 30 minute appointment is being requested, but any time would work. Also, if there is, for example, a planned 15 minute break in the middle of a long appointment, the duration may be 15 minutes less than the difference between the start and end.", 0, 1, minutesDuration);
case 3533310: /*slot*/ return new Property("slot", "Reference(Slot)", "The slots from the participants' schedules that will be filled by the appointment.", 0, java.lang.Integer.MAX_VALUE, slot);
case 1028554472: /*created*/ return new Property("created", "dateTime", "The date that this appointment was initially created. This could be different to the meta.lastModified value on the initial entry, as this could have been before the resource was created on the FHIR server, and should remain unchanged over the lifespan of the appointment.", 0, 1, created);
case 950398559: /*comment*/ return new Property("comment", "string", "Additional comments about the appointment.", 0, 1, comment);
case 737543241: /*patientInstruction*/ return new Property("patientInstruction", "string", "While Appointment.comment contains information for internal use, Appointment.patientInstructions is used to capture patient facing information about the Appointment (e.g. please bring your referral or fast from 8pm night before).", 0, 1, patientInstruction);
case -1258204701: /*incomingReferral*/ return new Property("incomingReferral", "Reference(ServiceRequest)", "The referral request this appointment is allocated to assess (incoming referral).", 0, java.lang.Integer.MAX_VALUE, incomingReferral);
case -332612366: /*basedOn*/ return new Property("basedOn", "Reference(ServiceRequest)", "The referral request this appointment is allocated to assess (incoming referral).", 0, java.lang.Integer.MAX_VALUE, basedOn);
case 767422259: /*participant*/ return new Property("participant", "", "List of participants involved in the appointment.", 0, java.lang.Integer.MAX_VALUE, participant);
case -897241393: /*requestedPeriod*/ return new Property("requestedPeriod", "Period", "A set of date ranges (potentially including times) that the appointment is preferred to be scheduled within. When using these values, the minutes duration should be provided to indicate the length of the appointment to fill and populate the start/end times for the actual allocated time.", 0, java.lang.Integer.MAX_VALUE, requestedPeriod);
default: return super.getNamedProperty(_hash, _name, _checkValid);
@ -2190,7 +2281,7 @@ public class Appointment extends DomainResource {
switch (hash) {
case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<AppointmentStatus>
case 1281188563: /*serviceCategory*/ return this.serviceCategory == null ? new Base[0] : new Base[] {this.serviceCategory}; // CodeableConcept
case 1281188563: /*serviceCategory*/ return this.serviceCategory == null ? new Base[0] : this.serviceCategory.toArray(new Base[this.serviceCategory.size()]); // CodeableConcept
case -1928370289: /*serviceType*/ return this.serviceType == null ? new Base[0] : this.serviceType.toArray(new Base[this.serviceType.size()]); // CodeableConcept
case -1694759682: /*specialty*/ return this.specialty == null ? new Base[0] : this.specialty.toArray(new Base[this.specialty.size()]); // CodeableConcept
case -1596426375: /*appointmentType*/ return this.appointmentType == null ? new Base[0] : new Base[] {this.appointmentType}; // CodeableConcept
@ -2206,7 +2297,7 @@ public class Appointment extends DomainResource {
case 1028554472: /*created*/ return this.created == null ? new Base[0] : new Base[] {this.created}; // DateTimeType
case 950398559: /*comment*/ return this.comment == null ? new Base[0] : new Base[] {this.comment}; // StringType
case 737543241: /*patientInstruction*/ return this.patientInstruction == null ? new Base[0] : new Base[] {this.patientInstruction}; // StringType
case -1258204701: /*incomingReferral*/ return this.incomingReferral == null ? new Base[0] : this.incomingReferral.toArray(new Base[this.incomingReferral.size()]); // Reference
case -332612366: /*basedOn*/ return this.basedOn == null ? new Base[0] : this.basedOn.toArray(new Base[this.basedOn.size()]); // Reference
case 767422259: /*participant*/ return this.participant == null ? new Base[0] : this.participant.toArray(new Base[this.participant.size()]); // AppointmentParticipantComponent
case -897241393: /*requestedPeriod*/ return this.requestedPeriod == null ? new Base[0] : this.requestedPeriod.toArray(new Base[this.requestedPeriod.size()]); // Period
default: return super.getProperty(hash, name, checkValid);
@ -2225,7 +2316,7 @@ public class Appointment extends DomainResource {
this.status = (Enumeration) value; // Enumeration<AppointmentStatus>
return value;
case 1281188563: // serviceCategory
this.serviceCategory = castToCodeableConcept(value); // CodeableConcept
this.getServiceCategory().add(castToCodeableConcept(value)); // CodeableConcept
return value;
case -1928370289: // serviceType
this.getServiceType().add(castToCodeableConcept(value)); // CodeableConcept
@ -2272,8 +2363,8 @@ public class Appointment extends DomainResource {
case 737543241: // patientInstruction
this.patientInstruction = castToString(value); // StringType
return value;
case -1258204701: // incomingReferral
this.getIncomingReferral().add(castToReference(value)); // Reference
case -332612366: // basedOn
this.getBasedOn().add(castToReference(value)); // Reference
return value;
case 767422259: // participant
this.getParticipant().add((AppointmentParticipantComponent) value); // AppointmentParticipantComponent
@ -2294,7 +2385,7 @@ public class Appointment extends DomainResource {
value = new AppointmentStatusEnumFactory().fromType(castToCode(value));
this.status = (Enumeration) value; // Enumeration<AppointmentStatus>
} else if (name.equals("serviceCategory")) {
this.serviceCategory = castToCodeableConcept(value); // CodeableConcept
this.getServiceCategory().add(castToCodeableConcept(value));
} else if (name.equals("serviceType")) {
this.getServiceType().add(castToCodeableConcept(value));
} else if (name.equals("specialty")) {
@ -2325,8 +2416,8 @@ public class Appointment extends DomainResource {
this.comment = castToString(value); // StringType
} else if (name.equals("patientInstruction")) {
this.patientInstruction = castToString(value); // StringType
} else if (name.equals("incomingReferral")) {
this.getIncomingReferral().add(castToReference(value));
} else if (name.equals("basedOn")) {
this.getBasedOn().add(castToReference(value));
} else if (name.equals("participant")) {
this.getParticipant().add((AppointmentParticipantComponent) value);
} else if (name.equals("requestedPeriod")) {
@ -2341,7 +2432,7 @@ public class Appointment extends DomainResource {
switch (hash) {
case -1618432855: return addIdentifier();
case -892481550: return getStatusElement();
case 1281188563: return getServiceCategory();
case 1281188563: return addServiceCategory();
case -1928370289: return addServiceType();
case -1694759682: return addSpecialty();
case -1596426375: return getAppointmentType();
@ -2357,7 +2448,7 @@ public class Appointment extends DomainResource {
case 1028554472: return getCreatedElement();
case 950398559: return getCommentElement();
case 737543241: return getPatientInstructionElement();
case -1258204701: return addIncomingReferral();
case -332612366: return addBasedOn();
case 767422259: return addParticipant();
case -897241393: return addRequestedPeriod();
default: return super.makeProperty(hash, name);
@ -2386,7 +2477,7 @@ public class Appointment extends DomainResource {
case 1028554472: /*created*/ return new String[] {"dateTime"};
case 950398559: /*comment*/ return new String[] {"string"};
case 737543241: /*patientInstruction*/ return new String[] {"string"};
case -1258204701: /*incomingReferral*/ return new String[] {"Reference"};
case -332612366: /*basedOn*/ return new String[] {"Reference"};
case 767422259: /*participant*/ return new String[] {};
case -897241393: /*requestedPeriod*/ return new String[] {"Period"};
default: return super.getTypesForProperty(hash, name);
@ -2403,8 +2494,7 @@ public class Appointment extends DomainResource {
throw new FHIRException("Cannot call addChild on a primitive type Appointment.status");
}
else if (name.equals("serviceCategory")) {
this.serviceCategory = new CodeableConcept();
return this.serviceCategory;
return addServiceCategory();
}
else if (name.equals("serviceType")) {
return addServiceType();
@ -2452,8 +2542,8 @@ public class Appointment extends DomainResource {
else if (name.equals("patientInstruction")) {
throw new FHIRException("Cannot call addChild on a primitive type Appointment.patientInstruction");
}
else if (name.equals("incomingReferral")) {
return addIncomingReferral();
else if (name.equals("basedOn")) {
return addBasedOn();
}
else if (name.equals("participant")) {
return addParticipant();
@ -2479,7 +2569,11 @@ public class Appointment extends DomainResource {
dst.identifier.add(i.copy());
};
dst.status = status == null ? null : status.copy();
dst.serviceCategory = serviceCategory == null ? null : serviceCategory.copy();
if (serviceCategory != null) {
dst.serviceCategory = new ArrayList<CodeableConcept>();
for (CodeableConcept i : serviceCategory)
dst.serviceCategory.add(i.copy());
};
if (serviceType != null) {
dst.serviceType = new ArrayList<CodeableConcept>();
for (CodeableConcept i : serviceType)
@ -2519,10 +2613,10 @@ public class Appointment extends DomainResource {
dst.created = created == null ? null : created.copy();
dst.comment = comment == null ? null : comment.copy();
dst.patientInstruction = patientInstruction == null ? null : patientInstruction.copy();
if (incomingReferral != null) {
dst.incomingReferral = new ArrayList<Reference>();
for (Reference i : incomingReferral)
dst.incomingReferral.add(i.copy());
if (basedOn != null) {
dst.basedOn = new ArrayList<Reference>();
for (Reference i : basedOn)
dst.basedOn.add(i.copy());
};
if (participant != null) {
dst.participant = new ArrayList<AppointmentParticipantComponent>();
@ -2554,7 +2648,7 @@ public class Appointment extends DomainResource {
&& compareDeep(description, o.description, true) && compareDeep(supportingInformation, o.supportingInformation, true)
&& compareDeep(start, o.start, true) && compareDeep(end, o.end, true) && compareDeep(minutesDuration, o.minutesDuration, true)
&& compareDeep(slot, o.slot, true) && compareDeep(created, o.created, true) && compareDeep(comment, o.comment, true)
&& compareDeep(patientInstruction, o.patientInstruction, true) && compareDeep(incomingReferral, o.incomingReferral, true)
&& compareDeep(patientInstruction, o.patientInstruction, true) && compareDeep(basedOn, o.basedOn, true)
&& compareDeep(participant, o.participant, true) && compareDeep(requestedPeriod, o.requestedPeriod, true)
;
}
@ -2576,7 +2670,7 @@ public class Appointment extends DomainResource {
return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, status, serviceCategory
, serviceType, specialty, appointmentType, reason, indication, priority, description
, supportingInformation, start, end, minutesDuration, slot, created, comment, patientInstruction
, incomingReferral, participant, requestedPeriod);
, basedOn, participant, requestedPeriod);
}
@Override
@ -2676,32 +2770,6 @@ public class Appointment extends DomainResource {
*/
public static final ca.uhn.fhir.model.api.Include INCLUDE_PRACTITIONER = new ca.uhn.fhir.model.api.Include("Appointment:practitioner").toLocked();
/**
* Search parameter: <b>incomingreferral</b>
* <p>
* Description: <b>The ServiceRequest provided as information to allocate to the Encounter</b><br>
* Type: <b>reference</b><br>
* Path: <b>Appointment.incomingReferral</b><br>
* </p>
*/
@SearchParamDefinition(name="incomingreferral", path="Appointment.incomingReferral", description="The ServiceRequest provided as information to allocate to the Encounter", type="reference", target={ServiceRequest.class } )
public static final String SP_INCOMINGREFERRAL = "incomingreferral";
/**
* <b>Fluent Client</b> search parameter constant for <b>incomingreferral</b>
* <p>
* Description: <b>The ServiceRequest provided as information to allocate to the Encounter</b><br>
* Type: <b>reference</b><br>
* Path: <b>Appointment.incomingReferral</b><br>
* </p>
*/
public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam INCOMINGREFERRAL = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_INCOMINGREFERRAL);
/**
* Constant for fluent queries to be used to add include statements. Specifies
* the path value of "<b>Appointment:incomingreferral</b>".
*/
public static final ca.uhn.fhir.model.api.Include INCLUDE_INCOMINGREFERRAL = new ca.uhn.fhir.model.api.Include("Appointment:incomingreferral").toLocked();
/**
* Search parameter: <b>part-status</b>
* <p>
@ -2814,6 +2882,32 @@ public class Appointment extends DomainResource {
*/
public static final ca.uhn.fhir.model.api.Include INCLUDE_LOCATION = new ca.uhn.fhir.model.api.Include("Appointment:location").toLocked();
/**
* Search parameter: <b>basedon</b>
* <p>
* Description: <b>The ServiceRequest provided as information to allocate to the Encounter</b><br>
* Type: <b>reference</b><br>
* Path: <b>Appointment.basedOn</b><br>
* </p>
*/
@SearchParamDefinition(name="basedon", path="Appointment.basedOn", description="The ServiceRequest provided as information to allocate to the Encounter", type="reference", target={ServiceRequest.class } )
public static final String SP_BASEDON = "basedon";
/**
* <b>Fluent Client</b> search parameter constant for <b>basedon</b>
* <p>
* Description: <b>The ServiceRequest provided as information to allocate to the Encounter</b><br>
* Type: <b>reference</b><br>
* Path: <b>Appointment.basedOn</b><br>
* </p>
*/
public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam BASEDON = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_BASEDON);
/**
* Constant for fluent queries to be used to add include statements. Specifies
* the path value of "<b>Appointment:basedon</b>".
*/
public static final ca.uhn.fhir.model.api.Include INCLUDE_BASEDON = new ca.uhn.fhir.model.api.Include("Appointment:basedon").toLocked();
/**
* Search parameter: <b>status</b>
* <p>

View File

@ -29,7 +29,7 @@ package org.hl7.fhir.r4.model;
*/
// Generated on Tue, Jan 9, 2018 14:51-0500 for FHIR v3.2.0
// Generated on Thu, Mar 1, 2018 20:26+1100 for FHIR v3.2.0
import java.util.*;

View File

@ -29,7 +29,7 @@ package org.hl7.fhir.r4.model;
*/
// Generated on Tue, Jan 9, 2018 14:51-0500 for FHIR v3.2.0
// Generated on Thu, Mar 1, 2018 20:26+1100 for FHIR v3.2.0
import java.util.*;
@ -73,9 +73,9 @@ public class Attachment extends Type implements ICompositeType {
/**
* An alternative location where the data can be accessed.
*/
@Child(name = "url", type = {UriType.class}, order=3, min=0, max=1, modifier=false, summary=true)
@Child(name = "url", type = {UrlType.class}, order=3, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="Uri where the data can be found", formalDefinition="An alternative location where the data can be accessed." )
protected UriType url;
protected UrlType url;
/**
* The number of bytes of data that make up this attachment (before base64 encoding, if that is done).
@ -105,7 +105,7 @@ public class Attachment extends Type implements ICompositeType {
@Description(shortDefinition="Date attachment was first created", formalDefinition="The date that the attachment was first created." )
protected DateTimeType creation;
private static final long serialVersionUID = 581007080L;
private static final long serialVersionUID = -564352571L;
/**
* Constructor
@ -264,12 +264,12 @@ public class Attachment extends Type implements ICompositeType {
/**
* @return {@link #url} (An alternative location where the data can be accessed.). This is the underlying object with id, value and extensions. The accessor "getUrl" gives direct access to the value
*/
public UriType getUrlElement() {
public UrlType getUrlElement() {
if (this.url == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create Attachment.url");
else if (Configuration.doAutoCreate())
this.url = new UriType(); // bb
this.url = new UrlType(); // bb
return this.url;
}
@ -284,7 +284,7 @@ public class Attachment extends Type implements ICompositeType {
/**
* @param value {@link #url} (An alternative location where the data can be accessed.). This is the underlying object with id, value and extensions. The accessor "getUrl" gives direct access to the value
*/
public Attachment setUrlElement(UriType value) {
public Attachment setUrlElement(UrlType value) {
this.url = value;
return this;
}
@ -304,7 +304,7 @@ public class Attachment extends Type implements ICompositeType {
this.url = null;
else {
if (this.url == null)
this.url = new UriType();
this.url = new UrlType();
this.url.setValue(value);
}
return this;
@ -507,7 +507,7 @@ public class Attachment extends Type implements ICompositeType {
children.add(new Property("contentType", "code", "Identifies the type of the data in the attachment and allows a method to be chosen to interpret or render the data. Includes mime type parameters such as charset where appropriate.", 0, 1, contentType));
children.add(new Property("language", "code", "The human language of the content. The value can be any valid value according to BCP 47.", 0, 1, language));
children.add(new Property("data", "base64Binary", "The actual data of the attachment - a sequence of bytes. In XML, represented using base64.", 0, 1, data));
children.add(new Property("url", "uri", "An alternative location where the data can be accessed.", 0, 1, url));
children.add(new Property("url", "url", "An alternative location where the data can be accessed.", 0, 1, url));
children.add(new Property("size", "unsignedInt", "The number of bytes of data that make up this attachment (before base64 encoding, if that is done).", 0, 1, size));
children.add(new Property("hash", "base64Binary", "The calculated hash of the data using SHA-1. Represented using base64.", 0, 1, hash));
children.add(new Property("title", "string", "A label or set of text to display in place of the data.", 0, 1, title));
@ -520,7 +520,7 @@ public class Attachment extends Type implements ICompositeType {
case -389131437: /*contentType*/ return new Property("contentType", "code", "Identifies the type of the data in the attachment and allows a method to be chosen to interpret or render the data. Includes mime type parameters such as charset where appropriate.", 0, 1, contentType);
case -1613589672: /*language*/ return new Property("language", "code", "The human language of the content. The value can be any valid value according to BCP 47.", 0, 1, language);
case 3076010: /*data*/ return new Property("data", "base64Binary", "The actual data of the attachment - a sequence of bytes. In XML, represented using base64.", 0, 1, data);
case 116079: /*url*/ return new Property("url", "uri", "An alternative location where the data can be accessed.", 0, 1, url);
case 116079: /*url*/ return new Property("url", "url", "An alternative location where the data can be accessed.", 0, 1, url);
case 3530753: /*size*/ return new Property("size", "unsignedInt", "The number of bytes of data that make up this attachment (before base64 encoding, if that is done).", 0, 1, size);
case 3195150: /*hash*/ return new Property("hash", "base64Binary", "The calculated hash of the data using SHA-1. Represented using base64.", 0, 1, hash);
case 110371416: /*title*/ return new Property("title", "string", "A label or set of text to display in place of the data.", 0, 1, title);
@ -536,7 +536,7 @@ public class Attachment extends Type implements ICompositeType {
case -389131437: /*contentType*/ return this.contentType == null ? new Base[0] : new Base[] {this.contentType}; // CodeType
case -1613589672: /*language*/ return this.language == null ? new Base[0] : new Base[] {this.language}; // CodeType
case 3076010: /*data*/ return this.data == null ? new Base[0] : new Base[] {this.data}; // Base64BinaryType
case 116079: /*url*/ return this.url == null ? new Base[0] : new Base[] {this.url}; // UriType
case 116079: /*url*/ return this.url == null ? new Base[0] : new Base[] {this.url}; // UrlType
case 3530753: /*size*/ return this.size == null ? new Base[0] : new Base[] {this.size}; // UnsignedIntType
case 3195150: /*hash*/ return this.hash == null ? new Base[0] : new Base[] {this.hash}; // Base64BinaryType
case 110371416: /*title*/ return this.title == null ? new Base[0] : new Base[] {this.title}; // StringType
@ -559,7 +559,7 @@ public class Attachment extends Type implements ICompositeType {
this.data = castToBase64Binary(value); // Base64BinaryType
return value;
case 116079: // url
this.url = castToUri(value); // UriType
this.url = castToUrl(value); // UrlType
return value;
case 3530753: // size
this.size = castToUnsignedInt(value); // UnsignedIntType
@ -587,7 +587,7 @@ public class Attachment extends Type implements ICompositeType {
} else if (name.equals("data")) {
this.data = castToBase64Binary(value); // Base64BinaryType
} else if (name.equals("url")) {
this.url = castToUri(value); // UriType
this.url = castToUrl(value); // UrlType
} else if (name.equals("size")) {
this.size = castToUnsignedInt(value); // UnsignedIntType
} else if (name.equals("hash")) {
@ -623,7 +623,7 @@ public class Attachment extends Type implements ICompositeType {
case -389131437: /*contentType*/ return new String[] {"code"};
case -1613589672: /*language*/ return new String[] {"code"};
case 3076010: /*data*/ return new String[] {"base64Binary"};
case 116079: /*url*/ return new String[] {"uri"};
case 116079: /*url*/ return new String[] {"url"};
case 3530753: /*size*/ return new String[] {"unsignedInt"};
case 3195150: /*hash*/ return new String[] {"base64Binary"};
case 110371416: /*title*/ return new String[] {"string"};

View File

@ -29,7 +29,7 @@ package org.hl7.fhir.r4.model;
*/
// Generated on Tue, Jan 9, 2018 14:51-0500 for FHIR v3.2.0
// Generated on Thu, Mar 1, 2018 20:26+1100 for FHIR v3.2.0
import java.util.*;
@ -953,7 +953,7 @@ public class AuditEvent extends DomainResource {
if (this.policy == null)
return false;
for (UriType v : this.policy)
if (v.equals(value)) // uri
if (v.getValue().equals(value)) // uri
return true;
return false;
}
@ -2919,10 +2919,10 @@ public class AuditEvent extends DomainResource {
protected Period period;
/**
* The time when the event occurred on the source.
* The time when the event was recorded.
*/
@Child(name = "recorded", type = {InstantType.class}, order=4, min=1, max=1, modifier=false, summary=true)
@Description(shortDefinition="Time when the event occurred on source", formalDefinition="The time when the event occurred on the source." )
@Description(shortDefinition="Time when the event was recorded", formalDefinition="The time when the event was recorded." )
protected InstantType recorded;
/**
@ -3139,7 +3139,7 @@ public class AuditEvent extends DomainResource {
}
/**
* @return {@link #recorded} (The time when the event occurred on the source.). This is the underlying object with id, value and extensions. The accessor "getRecorded" gives direct access to the value
* @return {@link #recorded} (The time when the event was recorded.). This is the underlying object with id, value and extensions. The accessor "getRecorded" gives direct access to the value
*/
public InstantType getRecordedElement() {
if (this.recorded == null)
@ -3159,7 +3159,7 @@ public class AuditEvent extends DomainResource {
}
/**
* @param value {@link #recorded} (The time when the event occurred on the source.). This is the underlying object with id, value and extensions. The accessor "getRecorded" gives direct access to the value
* @param value {@link #recorded} (The time when the event was recorded.). This is the underlying object with id, value and extensions. The accessor "getRecorded" gives direct access to the value
*/
public AuditEvent setRecordedElement(InstantType value) {
this.recorded = value;
@ -3167,14 +3167,14 @@ public class AuditEvent extends DomainResource {
}
/**
* @return The time when the event occurred on the source.
* @return The time when the event was recorded.
*/
public Date getRecorded() {
return this.recorded == null ? null : this.recorded.getValue();
}
/**
* @param value The time when the event occurred on the source.
* @param value The time when the event was recorded.
*/
public AuditEvent setRecorded(Date value) {
if (this.recorded == null)
@ -3470,7 +3470,7 @@ public class AuditEvent extends DomainResource {
children.add(new Property("subtype", "Coding", "Identifier for the category of event.", 0, java.lang.Integer.MAX_VALUE, subtype));
children.add(new Property("action", "code", "Indicator for type of action performed during the event that generated the audit.", 0, 1, action));
children.add(new Property("period", "Period", "The period during which the activity occurred.", 0, 1, period));
children.add(new Property("recorded", "instant", "The time when the event occurred on the source.", 0, 1, recorded));
children.add(new Property("recorded", "instant", "The time when the event was recorded.", 0, 1, recorded));
children.add(new Property("outcome", "code", "Indicates whether the event succeeded or failed.", 0, 1, outcome));
children.add(new Property("outcomeDesc", "string", "A free text description of the outcome of the event.", 0, 1, outcomeDesc));
children.add(new Property("purposeOfEvent", "CodeableConcept", "The purposeOfUse (reason) that was used during the event being recorded.", 0, java.lang.Integer.MAX_VALUE, purposeOfEvent));
@ -3486,7 +3486,7 @@ public class AuditEvent extends DomainResource {
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 -991726143: /*period*/ return new Property("period", "Period", "The period during which the activity occurred.", 0, 1, period);
case -799233872: /*recorded*/ return new Property("recorded", "instant", "The time when the event occurred on the source.", 0, 1, recorded);
case -799233872: /*recorded*/ return new Property("recorded", "instant", "The time when the event was recorded.", 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);
@ -3751,17 +3751,17 @@ public class AuditEvent extends DomainResource {
/**
* Search parameter: <b>date</b>
* <p>
* Description: <b>Time when the event occurred on source</b><br>
* Description: <b>Time when the event was recorded</b><br>
* Type: <b>date</b><br>
* Path: <b>AuditEvent.recorded</b><br>
* </p>
*/
@SearchParamDefinition(name="date", path="AuditEvent.recorded", description="Time when the event occurred on source", type="date" )
@SearchParamDefinition(name="date", path="AuditEvent.recorded", description="Time when the event was recorded", type="date" )
public static final String SP_DATE = "date";
/**
* <b>Fluent Client</b> search parameter constant for <b>date</b>
* <p>
* Description: <b>Time when the event occurred on source</b><br>
* Description: <b>Time when the event was recorded</b><br>
* Type: <b>date</b><br>
* Path: <b>AuditEvent.recorded</b><br>
* </p>

View File

@ -29,7 +29,7 @@ package org.hl7.fhir.r4.model;
*/
// Generated on Tue, Jan 9, 2018 14:51-0500 for FHIR v3.2.0
// Generated on Thu, Mar 1, 2018 20:26+1100 for FHIR v3.2.0
import java.util.*;

View File

@ -104,6 +104,10 @@ private Map<String, Object> userData;
return false;
}
public boolean isBooleanPrimitive() {
return false;
}
public boolean hasPrimitiveValue() {
return isPrimitive();
}
@ -314,15 +318,33 @@ private Map<String, Object> userData;
throw new FHIRException("Unable to convert a "+b.getClass().getName()+" to a String");
}
public UriType castToUri(Base b) throws FHIRException {
if (b instanceof UriType)
return (UriType) b;
else if (b.hasPrimitiveValue())
return new UriType(b.primitiveValue());
else
throw new FHIRException("Unable to convert a "+b.getClass().getName()+" to a Uri");
}
public UriType castToUri(Base b) throws FHIRException {
if (b instanceof UriType)
return (UriType) b;
else if (b.hasPrimitiveValue())
return new UriType(b.primitiveValue());
else
throw new FHIRException("Unable to convert a "+b.getClass().getName()+" to a Uri");
}
public UrlType castToUrl(Base b) throws FHIRException {
if (b instanceof UrlType)
return (UrlType) b;
else if (b.hasPrimitiveValue())
return new UrlType(b.primitiveValue());
else
throw new FHIRException("Unable to convert a "+b.getClass().getName()+" to a Uri");
}
public CanonicalType castToCanonical(Base b) throws FHIRException {
if (b instanceof CanonicalType)
return (CanonicalType) b;
else if (b.hasPrimitiveValue())
return new CanonicalType(b.primitiveValue());
else
throw new FHIRException("Unable to convert a "+b.getClass().getName()+" to a Uri");
}
public DateType castToDate(Base b) throws FHIRException {
if (b instanceof DateType)
return (DateType) b;

View File

@ -29,7 +29,7 @@ package org.hl7.fhir.r4.model;
*/
// Generated on Tue, Jan 9, 2018 14:51-0500 for FHIR v3.2.0
// Generated on Thu, Mar 1, 2018 20:26+1100 for FHIR v3.2.0
import java.util.*;

View File

@ -29,7 +29,7 @@ package org.hl7.fhir.r4.model;
*/
// Generated on Tue, Jan 9, 2018 14:51-0500 for FHIR v3.2.0
// Generated on Thu, Mar 1, 2018 20:26+1100 for FHIR v3.2.0
import java.util.*;

View File

@ -29,7 +29,7 @@ package org.hl7.fhir.r4.model;
*/
// Generated on Tue, Jan 9, 2018 14:51-0500 for FHIR v3.2.0
// Generated on Thu, Mar 1, 2018 20:26+1100 for FHIR v3.2.0
import java.util.*;

View File

@ -29,7 +29,7 @@ package org.hl7.fhir.r4.model;
*/
// Generated on Tue, Jan 9, 2018 14:51-0500 for FHIR v3.2.0
// Generated on Thu, Mar 1, 2018 20:26+1100 for FHIR v3.2.0
import java.util.*;

View File

@ -100,4 +100,10 @@ public class BooleanType extends PrimitiveType<Boolean> implements IBaseBooleanD
throw new DataFormatException("Invalid boolean string: '" + theValue + "'");
}
}
@Override
public boolean isBooleanPrimitive() {
return true;
}
}

View File

@ -29,7 +29,7 @@ package org.hl7.fhir.r4.model;
*/
// Generated on Tue, Jan 9, 2018 14:51-0500 for FHIR v3.2.0
// Generated on Thu, Mar 1, 2018 20:26+1100 for FHIR v3.2.0
import java.util.*;

View File

@ -0,0 +1,75 @@
/*
Copyright (c) 2011+, HL7, Inc
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of HL7 nor the names of its contributors may be used to
endorse or promote products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
package org.hl7.fhir.r4.model;
import java.net.URI;
import ca.uhn.fhir.model.api.annotation.DatatypeDef;
/**
* Primitive type "canonical" in FHIR: an OID represented as urn:oid:0.1.2.3.4...
*/
@DatatypeDef(name="canonical", profileOf=UriType.class)
public class CanonicalType extends UriType {
private static final long serialVersionUID = 4L;
/**
* Constructor
*/
public CanonicalType() {
super();
}
/**
* Constructor
*/
public CanonicalType(String theValue) {
super(theValue);
}
/**
* Constructor
*/
public CanonicalType(URI theValue) {
super(theValue);
}
/**
* Constructor
*/
@Override
public CanonicalType copy() {
return new CanonicalType(getValue());
}
public String fhirType() {
return "canonical";
}
}

View File

@ -29,7 +29,7 @@ package org.hl7.fhir.r4.model;
*/
// Generated on Tue, Jan 9, 2018 14:51-0500 for FHIR v3.2.0
// Generated on Thu, Mar 1, 2018 20:26+1100 for FHIR v3.2.0
import java.util.*;
@ -1265,10 +1265,10 @@ Refer to [[[RequestGroup]]] for additional information on how this status is use
protected StringType statusReason;
/**
* If true, indicates that the described activity is one that must NOT be engaged in when following the plan. If false, indicates that the described activity is one that should be engaged in when following the plan.
* If true, indicates that the described activity is one that must NOT be engaged in when following the plan. If false, or missing, indicates that the described activity is one that should be engaged in when following the plan.
*/
@Child(name = "prohibited", type = {BooleanType.class}, order=9, min=0, max=1, modifier=true, summary=false)
@Description(shortDefinition="Do NOT do", formalDefinition="If true, indicates that the described activity is one that must NOT be engaged in when following the plan. If false, indicates that the described activity is one that should be engaged in when following the plan." )
@Description(shortDefinition="Do NOT do", formalDefinition="If true, indicates that the described activity is one that must NOT be engaged in when following the plan. If false, or missing, indicates that the described activity is one that should be engaged in when following the plan." )
protected BooleanType prohibited;
/**
@ -1756,7 +1756,7 @@ Refer to [[[RequestGroup]]] for additional information on how this status is use
}
/**
* @return {@link #prohibited} (If true, indicates that the described activity is one that must NOT be engaged in when following the plan. If false, indicates that the described activity is one that should be engaged in when following the plan.). This is the underlying object with id, value and extensions. The accessor "getProhibited" gives direct access to the value
* @return {@link #prohibited} (If true, indicates that the described activity is one that must NOT be engaged in when following the plan. If false, or missing, indicates that the described activity is one that should be engaged in when following the plan.). This is the underlying object with id, value and extensions. The accessor "getProhibited" gives direct access to the value
*/
public BooleanType getProhibitedElement() {
if (this.prohibited == null)
@ -1776,7 +1776,7 @@ Refer to [[[RequestGroup]]] for additional information on how this status is use
}
/**
* @param value {@link #prohibited} (If true, indicates that the described activity is one that must NOT be engaged in when following the plan. If false, indicates that the described activity is one that should be engaged in when following the plan.). This is the underlying object with id, value and extensions. The accessor "getProhibited" gives direct access to the value
* @param value {@link #prohibited} (If true, indicates that the described activity is one that must NOT be engaged in when following the plan. If false, or missing, indicates that the described activity is one that should be engaged in when following the plan.). This is the underlying object with id, value and extensions. The accessor "getProhibited" gives direct access to the value
*/
public CarePlanActivityDetailComponent setProhibitedElement(BooleanType value) {
this.prohibited = value;
@ -1784,14 +1784,14 @@ Refer to [[[RequestGroup]]] for additional information on how this status is use
}
/**
* @return If true, indicates that the described activity is one that must NOT be engaged in when following the plan. If false, indicates that the described activity is one that should be engaged in when following the plan.
* @return If true, indicates that the described activity is one that must NOT be engaged in when following the plan. If false, or missing, indicates that the described activity is one that should be engaged in when following the plan.
*/
public boolean getProhibited() {
return this.prohibited == null || this.prohibited.isEmpty() ? false : this.prohibited.getValue();
}
/**
* @param value If true, indicates that the described activity is one that must NOT be engaged in when following the plan. If false, indicates that the described activity is one that should be engaged in when following the plan.
* @param value If true, indicates that the described activity is one that must NOT be engaged in when following the plan. If false, or missing, indicates that the described activity is one that should be engaged in when following the plan.
*/
public CarePlanActivityDetailComponent setProhibited(boolean value) {
if (this.prohibited == null)
@ -2117,7 +2117,7 @@ Refer to [[[RequestGroup]]] for additional information on how this status is use
children.add(new Property("goal", "Reference(Goal)", "Internal reference that identifies the goals that this activity is intended to contribute towards meeting.", 0, java.lang.Integer.MAX_VALUE, goal));
children.add(new Property("status", "code", "Identifies what progress is being made for the specific activity.", 0, 1, status));
children.add(new Property("statusReason", "string", "Provides reason why the activity isn't yet started, is on hold, was cancelled, etc.", 0, 1, statusReason));
children.add(new Property("prohibited", "boolean", "If true, indicates that the described activity is one that must NOT be engaged in when following the plan. If false, indicates that the described activity is one that should be engaged in when following the plan.", 0, 1, prohibited));
children.add(new Property("prohibited", "boolean", "If true, indicates that the described activity is one that must NOT be engaged in when following the plan. If false, or missing, indicates that the described activity is one that should be engaged in when following the plan.", 0, 1, prohibited));
children.add(new Property("scheduled[x]", "Timing|Period|string", "The period, timing or frequency upon which the described activity is to occur.", 0, 1, scheduled));
children.add(new Property("location", "Reference(Location)", "Identifies the facility where the activity will occur; e.g. home, hospital, specific clinic, etc.", 0, 1, location));
children.add(new Property("performer", "Reference(Practitioner|PractitionerRole|Organization|RelatedPerson|Patient|CareTeam|HealthcareService|Device)", "Identifies who's expected to be involved in the activity.", 0, java.lang.Integer.MAX_VALUE, performer));
@ -2138,7 +2138,7 @@ Refer to [[[RequestGroup]]] for additional information on how this status is use
case 3178259: /*goal*/ return new Property("goal", "Reference(Goal)", "Internal reference that identifies the goals that this activity is intended to contribute towards meeting.", 0, java.lang.Integer.MAX_VALUE, goal);
case -892481550: /*status*/ return new Property("status", "code", "Identifies what progress is being made for the specific activity.", 0, 1, status);
case 2051346646: /*statusReason*/ return new Property("statusReason", "string", "Provides reason why the activity isn't yet started, is on hold, was cancelled, etc.", 0, 1, statusReason);
case 663275198: /*prohibited*/ return new Property("prohibited", "boolean", "If true, indicates that the described activity is one that must NOT be engaged in when following the plan. If false, indicates that the described activity is one that should be engaged in when following the plan.", 0, 1, prohibited);
case 663275198: /*prohibited*/ return new Property("prohibited", "boolean", "If true, indicates that the described activity is one that must NOT be engaged in when following the plan. If false, or missing, indicates that the described activity is one that should be engaged in when following the plan.", 0, 1, prohibited);
case 1162627251: /*scheduled[x]*/ return new Property("scheduled[x]", "Timing|Period|string", "The period, timing or frequency upon which the described activity is to occur.", 0, 1, scheduled);
case -160710483: /*scheduled*/ return new Property("scheduled[x]", "Timing|Period|string", "The period, timing or frequency upon which the described activity is to occur.", 0, 1, scheduled);
case 998483799: /*scheduledTiming*/ return new Property("scheduled[x]", "Timing|Period|string", "The period, timing or frequency upon which the described activity is to occur.", 0, 1, scheduled);
@ -2802,7 +2802,7 @@ Refer to [[[RequestGroup]]] for additional information on how this status is use
if (this.instantiates == null)
return false;
for (UriType v : this.instantiates)
if (v.equals(value)) // uri
if (v.getValue().equals(value)) // uri
return true;
return false;
}

View File

@ -29,7 +29,7 @@ package org.hl7.fhir.r4.model;
*/
// Generated on Tue, Jan 9, 2018 14:51-0500 for FHIR v3.2.0
// Generated on Thu, Mar 1, 2018 20:26+1100 for FHIR v3.2.0
import java.util.*;

View File

@ -29,7 +29,7 @@ package org.hl7.fhir.r4.model;
*/
// Generated on Tue, Jan 9, 2018 14:51-0500 for FHIR v3.2.0
// Generated on Thu, Mar 1, 2018 20:26+1100 for FHIR v3.2.0
import java.util.*;
@ -450,9 +450,9 @@ public class ChargeItem extends DomainResource {
/**
* Identifiers assigned to this event performer or other systems.
*/
@Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=1, modifier=false, summary=true)
@Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
@Description(shortDefinition="Business Identifier for item", formalDefinition="Identifiers assigned to this event performer or other systems." )
protected Identifier identifier;
protected List<Identifier> identifier;
/**
* References the source of pricing information, rules of application for the code this ChargeItem uses.
@ -551,17 +551,29 @@ public class ChargeItem extends DomainResource {
*/
protected Organization requestingOrganizationTarget;
/**
* The financial cost center permits the tracking of charge attribution.
*/
@Child(name = "costCenter", type = {Organization.class, OrganizationRole.class}, order=11, min=0, max=1, modifier=false, summary=false)
@Description(shortDefinition="Organization that has ownership of the (potential, future) revenue", formalDefinition="The financial cost center permits the tracking of charge attribution." )
protected Reference costCenter;
/**
* The actual object that is the target of the reference (The financial cost center permits the tracking of charge attribution.)
*/
protected Resource costCenterTarget;
/**
* Quantity of which the charge item has been serviced.
*/
@Child(name = "quantity", type = {Quantity.class}, order=11, min=0, max=1, modifier=false, summary=true)
@Child(name = "quantity", type = {Quantity.class}, order=12, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="Quantity of which the charge item has been serviced", formalDefinition="Quantity of which the charge item has been serviced." )
protected Quantity quantity;
/**
* The anatomical location where the related service has been applied.
*/
@Child(name = "bodysite", type = {CodeableConcept.class}, order=12, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
@Child(name = "bodysite", type = {CodeableConcept.class}, order=13, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
@Description(shortDefinition="Anatomical location, if relevant", formalDefinition="The anatomical location where the related service has been applied." )
@ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/body-site")
protected List<CodeableConcept> bodysite;
@ -569,28 +581,28 @@ public class ChargeItem extends DomainResource {
/**
* Factor overriding the factor determined by the rules associated with the code.
*/
@Child(name = "factorOverride", type = {DecimalType.class}, order=13, min=0, max=1, modifier=false, summary=false)
@Child(name = "factorOverride", type = {DecimalType.class}, order=14, min=0, max=1, modifier=false, summary=false)
@Description(shortDefinition="Factor overriding the associated rules", formalDefinition="Factor overriding the factor determined by the rules associated with the code." )
protected DecimalType factorOverride;
/**
* Total price of the charge overriding the list price associated with the code.
*/
@Child(name = "priceOverride", type = {Money.class}, order=14, min=0, max=1, modifier=false, summary=false)
@Child(name = "priceOverride", type = {Money.class}, order=15, min=0, max=1, modifier=false, summary=false)
@Description(shortDefinition="Price overriding the associated rules", formalDefinition="Total price of the charge overriding the list price associated with the code." )
protected Money priceOverride;
/**
* If the list price or the rule based factor associated with the code is overridden, this attribute can capture a text to indicate the reason for this action.
*/
@Child(name = "overrideReason", type = {StringType.class}, order=15, min=0, max=1, modifier=false, summary=false)
@Child(name = "overrideReason", type = {StringType.class}, order=16, min=0, max=1, modifier=false, summary=false)
@Description(shortDefinition="Reason for overriding the list price/factor", formalDefinition="If the list price or the rule based factor associated with the code is overridden, this attribute can capture a text to indicate the reason for this action." )
protected StringType overrideReason;
/**
* The device, practitioner, etc. who entered the charge item.
*/
@Child(name = "enterer", type = {Practitioner.class, Organization.class, Patient.class, Device.class, RelatedPerson.class}, order=16, min=0, max=1, modifier=false, summary=true)
@Child(name = "enterer", type = {Practitioner.class, Organization.class, Patient.class, Device.class, RelatedPerson.class}, order=17, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="Individual who was entering", formalDefinition="The device, practitioner, etc. who entered the charge item." )
protected Reference enterer;
@ -602,14 +614,14 @@ public class ChargeItem extends DomainResource {
/**
* Date the charge item was entered.
*/
@Child(name = "enteredDate", type = {DateTimeType.class}, order=17, min=0, max=1, modifier=false, summary=true)
@Child(name = "enteredDate", type = {DateTimeType.class}, order=18, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="Date the charge item was entered", formalDefinition="Date the charge item was entered." )
protected DateTimeType enteredDate;
/**
* Describes why the event occurred in coded or textual form.
*/
@Child(name = "reason", type = {CodeableConcept.class}, order=18, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
@Child(name = "reason", type = {CodeableConcept.class}, order=19, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
@Description(shortDefinition="Why was the charged service rendered?", formalDefinition="Describes why the event occurred in coded or textual form." )
@ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/icd-10")
protected List<CodeableConcept> reason;
@ -617,7 +629,7 @@ public class ChargeItem extends DomainResource {
/**
* Indicated the rendered service that caused this charge.
*/
@Child(name = "service", type = {DiagnosticReport.class, ImagingStudy.class, Immunization.class, MedicationAdministration.class, MedicationDispense.class, Observation.class, Procedure.class, SupplyDelivery.class}, order=19, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
@Child(name = "service", type = {DiagnosticReport.class, ImagingStudy.class, Immunization.class, MedicationAdministration.class, MedicationDispense.class, Observation.class, Procedure.class, SupplyDelivery.class}, order=20, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
@Description(shortDefinition="Which rendered service is being charged?", formalDefinition="Indicated the rendered service that caused this charge." )
protected List<Reference> service;
/**
@ -629,7 +641,7 @@ public class ChargeItem extends DomainResource {
/**
* Account into which this ChargeItems belongs.
*/
@Child(name = "account", type = {Account.class}, order=20, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
@Child(name = "account", type = {Account.class}, order=21, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
@Description(shortDefinition="Account to place this charge", formalDefinition="Account into which this ChargeItems belongs." )
protected List<Reference> account;
/**
@ -641,14 +653,14 @@ public class ChargeItem extends DomainResource {
/**
* Comments made about the event by the performer, subject or other participants.
*/
@Child(name = "note", type = {Annotation.class}, order=21, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
@Child(name = "note", type = {Annotation.class}, order=22, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
@Description(shortDefinition="Comments made about the ChargeItem", formalDefinition="Comments made about the event by the performer, subject or other participants." )
protected List<Annotation> note;
/**
* Further information supporting the this charge.
*/
@Child(name = "supportingInformation", type = {Reference.class}, order=22, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
@Child(name = "supportingInformation", type = {Reference.class}, order=23, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
@Description(shortDefinition="Further information supporting the this charge", formalDefinition="Further information supporting the this charge." )
protected List<Reference> supportingInformation;
/**
@ -657,7 +669,7 @@ public class ChargeItem extends DomainResource {
protected List<Resource> supportingInformationTarget;
private static final long serialVersionUID = 1421123938L;
private static final long serialVersionUID = -28479866L;
/**
* Constructor
@ -679,25 +691,54 @@ public class ChargeItem extends DomainResource {
/**
* @return {@link #identifier} (Identifiers assigned to this event performer or other systems.)
*/
public Identifier getIdentifier() {
public List<Identifier> getIdentifier() {
if (this.identifier == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create ChargeItem.identifier");
else if (Configuration.doAutoCreate())
this.identifier = new Identifier(); // cc
this.identifier = new ArrayList<Identifier>();
return this.identifier;
}
/**
* @return Returns a reference to <code>this</code> for easy method chaining
*/
public ChargeItem setIdentifier(List<Identifier> theIdentifier) {
this.identifier = theIdentifier;
return this;
}
public boolean hasIdentifier() {
return this.identifier != null && !this.identifier.isEmpty();
if (this.identifier == null)
return false;
for (Identifier item : this.identifier)
if (!item.isEmpty())
return true;
return false;
}
public Identifier addIdentifier() { //3
Identifier t = new Identifier();
if (this.identifier == null)
this.identifier = new ArrayList<Identifier>();
this.identifier.add(t);
return t;
}
public ChargeItem addIdentifier(Identifier t) { //3
if (t == null)
return this;
if (this.identifier == null)
this.identifier = new ArrayList<Identifier>();
this.identifier.add(t);
return this;
}
/**
* @param value {@link #identifier} (Identifiers assigned to this event performer or other systems.)
* @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist
*/
public ChargeItem setIdentifier(Identifier value) {
this.identifier = value;
return this;
public Identifier getIdentifierFirstRep() {
if (getIdentifier().isEmpty()) {
addIdentifier();
}
return getIdentifier().get(0);
}
/**
@ -756,7 +797,7 @@ public class ChargeItem extends DomainResource {
if (this.definition == null)
return false;
for (UriType v : this.definition)
if (v.equals(value)) // uri
if (v.getValue().equals(value)) // uri
return true;
return false;
}
@ -1182,6 +1223,45 @@ public class ChargeItem extends DomainResource {
return this;
}
/**
* @return {@link #costCenter} (The financial cost center permits the tracking of charge attribution.)
*/
public Reference getCostCenter() {
if (this.costCenter == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create ChargeItem.costCenter");
else if (Configuration.doAutoCreate())
this.costCenter = new Reference(); // cc
return this.costCenter;
}
public boolean hasCostCenter() {
return this.costCenter != null && !this.costCenter.isEmpty();
}
/**
* @param value {@link #costCenter} (The financial cost center permits the tracking of charge attribution.)
*/
public ChargeItem setCostCenter(Reference value) {
this.costCenter = value;
return this;
}
/**
* @return {@link #costCenter} 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 financial cost center permits the tracking of charge attribution.)
*/
public Resource getCostCenterTarget() {
return this.costCenterTarget;
}
/**
* @param value {@link #costCenter} 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 financial cost center permits the tracking of charge attribution.)
*/
public ChargeItem setCostCenterTarget(Resource value) {
this.costCenterTarget = value;
return this;
}
/**
* @return {@link #quantity} (Quantity of which the charge item has been serviced.)
*/
@ -1796,7 +1876,7 @@ public class ChargeItem extends DomainResource {
protected void listChildren(List<Property> children) {
super.listChildren(children);
children.add(new Property("identifier", "Identifier", "Identifiers assigned to this event performer or other systems.", 0, 1, identifier));
children.add(new Property("identifier", "Identifier", "Identifiers assigned to this event performer or other systems.", 0, java.lang.Integer.MAX_VALUE, identifier));
children.add(new Property("definition", "uri", "References the source of pricing information, rules of application for the code this ChargeItem uses.", 0, java.lang.Integer.MAX_VALUE, definition));
children.add(new Property("status", "code", "The current state of the ChargeItem.", 0, 1, status));
children.add(new Property("partOf", "Reference(ChargeItem)", "ChargeItems can be grouped to larger ChargeItems covering the whole set.", 0, java.lang.Integer.MAX_VALUE, partOf));
@ -1807,6 +1887,7 @@ public class ChargeItem extends DomainResource {
children.add(new Property("participant", "", "Indicates who or what performed or participated in the charged service.", 0, java.lang.Integer.MAX_VALUE, participant));
children.add(new Property("performingOrganization", "Reference(Organization)", "The organization requesting the service.", 0, 1, performingOrganization));
children.add(new Property("requestingOrganization", "Reference(Organization)", "The organization performing the service.", 0, 1, requestingOrganization));
children.add(new Property("costCenter", "Reference(Organization|OrganizationRole)", "The financial cost center permits the tracking of charge attribution.", 0, 1, costCenter));
children.add(new Property("quantity", "Quantity", "Quantity of which the charge item has been serviced.", 0, 1, quantity));
children.add(new Property("bodysite", "CodeableConcept", "The anatomical location where the related service has been applied.", 0, java.lang.Integer.MAX_VALUE, bodysite));
children.add(new Property("factorOverride", "decimal", "Factor overriding the factor determined by the rules associated with the code.", 0, 1, factorOverride));
@ -1824,7 +1905,7 @@ public class ChargeItem extends DomainResource {
@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 event performer or other systems.", 0, 1, identifier);
case -1618432855: /*identifier*/ return new Property("identifier", "Identifier", "Identifiers assigned to this event performer or other systems.", 0, java.lang.Integer.MAX_VALUE, identifier);
case -1014418093: /*definition*/ return new Property("definition", "uri", "References the source of pricing information, rules of application for the code this ChargeItem uses.", 0, java.lang.Integer.MAX_VALUE, definition);
case -892481550: /*status*/ return new Property("status", "code", "The current state of the ChargeItem.", 0, 1, status);
case -995410646: /*partOf*/ return new Property("partOf", "Reference(ChargeItem)", "ChargeItems can be grouped to larger ChargeItems covering the whole set.", 0, java.lang.Integer.MAX_VALUE, partOf);
@ -1839,6 +1920,7 @@ public class ChargeItem extends DomainResource {
case 767422259: /*participant*/ return new Property("participant", "", "Indicates who or what performed or participated in the charged service.", 0, java.lang.Integer.MAX_VALUE, participant);
case 1273192628: /*performingOrganization*/ return new Property("performingOrganization", "Reference(Organization)", "The organization requesting the service.", 0, 1, performingOrganization);
case 1279054790: /*requestingOrganization*/ return new Property("requestingOrganization", "Reference(Organization)", "The organization performing the service.", 0, 1, requestingOrganization);
case -593192318: /*costCenter*/ return new Property("costCenter", "Reference(Organization|OrganizationRole)", "The financial cost center permits the tracking of charge attribution.", 0, 1, costCenter);
case -1285004149: /*quantity*/ return new Property("quantity", "Quantity", "Quantity of which the charge item has been serviced.", 0, 1, quantity);
case 1703573481: /*bodysite*/ return new Property("bodysite", "CodeableConcept", "The anatomical location where the related service has been applied.", 0, java.lang.Integer.MAX_VALUE, bodysite);
case -451233221: /*factorOverride*/ return new Property("factorOverride", "decimal", "Factor overriding the factor determined by the rules associated with the code.", 0, 1, factorOverride);
@ -1859,7 +1941,7 @@ public class ChargeItem extends DomainResource {
@Override
public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
switch (hash) {
case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : new Base[] {this.identifier}; // Identifier
case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
case -1014418093: /*definition*/ return this.definition == null ? new Base[0] : this.definition.toArray(new Base[this.definition.size()]); // UriType
case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<ChargeItemStatus>
case -995410646: /*partOf*/ return this.partOf == null ? new Base[0] : this.partOf.toArray(new Base[this.partOf.size()]); // Reference
@ -1870,6 +1952,7 @@ public class ChargeItem extends DomainResource {
case 767422259: /*participant*/ return this.participant == null ? new Base[0] : this.participant.toArray(new Base[this.participant.size()]); // ChargeItemParticipantComponent
case 1273192628: /*performingOrganization*/ return this.performingOrganization == null ? new Base[0] : new Base[] {this.performingOrganization}; // Reference
case 1279054790: /*requestingOrganization*/ return this.requestingOrganization == null ? new Base[0] : new Base[] {this.requestingOrganization}; // Reference
case -593192318: /*costCenter*/ return this.costCenter == null ? new Base[0] : new Base[] {this.costCenter}; // Reference
case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // Quantity
case 1703573481: /*bodysite*/ return this.bodysite == null ? new Base[0] : this.bodysite.toArray(new Base[this.bodysite.size()]); // CodeableConcept
case -451233221: /*factorOverride*/ return this.factorOverride == null ? new Base[0] : new Base[] {this.factorOverride}; // DecimalType
@ -1891,7 +1974,7 @@ public class ChargeItem extends DomainResource {
public Base setProperty(int hash, String name, Base value) throws FHIRException {
switch (hash) {
case -1618432855: // identifier
this.identifier = castToIdentifier(value); // Identifier
this.getIdentifier().add(castToIdentifier(value)); // Identifier
return value;
case -1014418093: // definition
this.getDefinition().add(castToUri(value)); // UriType
@ -1924,6 +2007,9 @@ public class ChargeItem extends DomainResource {
case 1279054790: // requestingOrganization
this.requestingOrganization = castToReference(value); // Reference
return value;
case -593192318: // costCenter
this.costCenter = castToReference(value); // Reference
return value;
case -1285004149: // quantity
this.quantity = castToQuantity(value); // Quantity
return value;
@ -1968,7 +2054,7 @@ public class ChargeItem extends DomainResource {
@Override
public Base setProperty(String name, Base value) throws FHIRException {
if (name.equals("identifier")) {
this.identifier = castToIdentifier(value); // Identifier
this.getIdentifier().add(castToIdentifier(value));
} else if (name.equals("definition")) {
this.getDefinition().add(castToUri(value));
} else if (name.equals("status")) {
@ -1990,6 +2076,8 @@ public class ChargeItem extends DomainResource {
this.performingOrganization = castToReference(value); // Reference
} else if (name.equals("requestingOrganization")) {
this.requestingOrganization = castToReference(value); // Reference
} else if (name.equals("costCenter")) {
this.costCenter = castToReference(value); // Reference
} else if (name.equals("quantity")) {
this.quantity = castToQuantity(value); // Quantity
} else if (name.equals("bodysite")) {
@ -2022,7 +2110,7 @@ public class ChargeItem extends DomainResource {
@Override
public Base makeProperty(int hash, String name) throws FHIRException {
switch (hash) {
case -1618432855: return getIdentifier();
case -1618432855: return addIdentifier();
case -1014418093: return addDefinitionElement();
case -892481550: return getStatusElement();
case -995410646: return addPartOf();
@ -2034,6 +2122,7 @@ public class ChargeItem extends DomainResource {
case 767422259: return addParticipant();
case 1273192628: return getPerformingOrganization();
case 1279054790: return getRequestingOrganization();
case -593192318: return getCostCenter();
case -1285004149: return getQuantity();
case 1703573481: return addBodysite();
case -451233221: return getFactorOverrideElement();
@ -2065,6 +2154,7 @@ public class ChargeItem extends DomainResource {
case 767422259: /*participant*/ return new String[] {};
case 1273192628: /*performingOrganization*/ return new String[] {"Reference"};
case 1279054790: /*requestingOrganization*/ return new String[] {"Reference"};
case -593192318: /*costCenter*/ return new String[] {"Reference"};
case -1285004149: /*quantity*/ return new String[] {"Quantity"};
case 1703573481: /*bodysite*/ return new String[] {"CodeableConcept"};
case -451233221: /*factorOverride*/ return new String[] {"decimal"};
@ -2085,8 +2175,7 @@ public class ChargeItem extends DomainResource {
@Override
public Base addChild(String name) throws FHIRException {
if (name.equals("identifier")) {
this.identifier = new Identifier();
return this.identifier;
return addIdentifier();
}
else if (name.equals("definition")) {
throw new FHIRException("Cannot call addChild on a primitive type ChargeItem.definition");
@ -2132,6 +2221,10 @@ public class ChargeItem extends DomainResource {
this.requestingOrganization = new Reference();
return this.requestingOrganization;
}
else if (name.equals("costCenter")) {
this.costCenter = new Reference();
return this.costCenter;
}
else if (name.equals("quantity")) {
this.quantity = new Quantity();
return this.quantity;
@ -2183,7 +2276,11 @@ public class ChargeItem extends DomainResource {
public ChargeItem copy() {
ChargeItem dst = new ChargeItem();
copyValues(dst);
dst.identifier = identifier == null ? null : identifier.copy();
if (identifier != null) {
dst.identifier = new ArrayList<Identifier>();
for (Identifier i : identifier)
dst.identifier.add(i.copy());
};
if (definition != null) {
dst.definition = new ArrayList<UriType>();
for (UriType i : definition)
@ -2206,6 +2303,7 @@ public class ChargeItem extends DomainResource {
};
dst.performingOrganization = performingOrganization == null ? null : performingOrganization.copy();
dst.requestingOrganization = requestingOrganization == null ? null : requestingOrganization.copy();
dst.costCenter = costCenter == null ? null : costCenter.copy();
dst.quantity = quantity == null ? null : quantity.copy();
if (bodysite != null) {
dst.bodysite = new ArrayList<CodeableConcept>();
@ -2260,8 +2358,8 @@ public class ChargeItem extends DomainResource {
&& compareDeep(status, o.status, true) && compareDeep(partOf, o.partOf, true) && compareDeep(code, o.code, true)
&& compareDeep(subject, o.subject, true) && compareDeep(context, o.context, true) && compareDeep(occurrence, o.occurrence, true)
&& compareDeep(participant, o.participant, true) && compareDeep(performingOrganization, o.performingOrganization, true)
&& compareDeep(requestingOrganization, o.requestingOrganization, true) && compareDeep(quantity, o.quantity, true)
&& compareDeep(bodysite, o.bodysite, true) && compareDeep(factorOverride, o.factorOverride, true)
&& compareDeep(requestingOrganization, o.requestingOrganization, true) && compareDeep(costCenter, o.costCenter, true)
&& compareDeep(quantity, o.quantity, true) && compareDeep(bodysite, o.bodysite, true) && compareDeep(factorOverride, o.factorOverride, true)
&& compareDeep(priceOverride, o.priceOverride, true) && compareDeep(overrideReason, o.overrideReason, true)
&& compareDeep(enterer, o.enterer, true) && compareDeep(enteredDate, o.enteredDate, true) && compareDeep(reason, o.reason, true)
&& compareDeep(service, o.service, true) && compareDeep(account, o.account, true) && compareDeep(note, o.note, true)
@ -2283,8 +2381,8 @@ public class ChargeItem extends DomainResource {
public boolean isEmpty() {
return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, definition, status
, partOf, code, subject, context, occurrence, participant, performingOrganization
, requestingOrganization, quantity, bodysite, factorOverride, priceOverride, overrideReason
, enterer, enteredDate, reason, service, account, note, supportingInformation
, requestingOrganization, costCenter, quantity, bodysite, factorOverride, priceOverride
, overrideReason, enterer, enteredDate, reason, service, account, note, supportingInformation
);
}

View File

@ -29,7 +29,7 @@ package org.hl7.fhir.r4.model;
*/
// Generated on Tue, Jan 9, 2018 14:51-0500 for FHIR v3.2.0
// Generated on Thu, Mar 1, 2018 20:26+1100 for FHIR v3.2.0
import java.util.*;
@ -849,7 +849,7 @@ public class Claim extends DomainResource {
* Sequence of the careTeam which serves to order and provide a link.
*/
@Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=false)
@Description(shortDefinition="Number to covey order of careTeam", formalDefinition="Sequence of the careTeam which serves to order and provide a link." )
@Description(shortDefinition="Number to convey order of careTeam", formalDefinition="Sequence of the careTeam which serves to order and provide a link." )
protected PositiveIntType sequence;
/**
@ -1768,7 +1768,7 @@ public class Claim extends DomainResource {
* Sequence of diagnosis which serves to provide a link.
*/
@Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=false)
@Description(shortDefinition="Number to covey order of diagnosis", formalDefinition="Sequence of diagnosis which serves to provide a link." )
@Description(shortDefinition="Number to convey order of diagnosis", formalDefinition="Sequence of diagnosis which serves to provide a link." )
protected PositiveIntType sequence;
/**
@ -2817,7 +2817,7 @@ public class Claim extends DomainResource {
if (this.preAuthRef == null)
return false;
for (StringType v : this.preAuthRef)
if (v.equals(value)) // string
if (v.getValue().equals(value)) // string
return true;
return false;
}
@ -3657,7 +3657,7 @@ public class Claim extends DomainResource {
if (this.careTeamSequence == null)
return false;
for (PositiveIntType v : this.careTeamSequence)
if (v.equals(value)) // positiveInt
if (v.getValue().equals(value)) // positiveInt
return true;
return false;
}
@ -3718,7 +3718,7 @@ public class Claim extends DomainResource {
if (this.diagnosisSequence == null)
return false;
for (PositiveIntType v : this.diagnosisSequence)
if (v.equals(value)) // positiveInt
if (v.getValue().equals(value)) // positiveInt
return true;
return false;
}
@ -3779,7 +3779,7 @@ public class Claim extends DomainResource {
if (this.procedureSequence == null)
return false;
for (PositiveIntType v : this.procedureSequence)
if (v.equals(value)) // positiveInt
if (v.getValue().equals(value)) // positiveInt
return true;
return false;
}
@ -3840,7 +3840,7 @@ public class Claim extends DomainResource {
if (this.informationSequence == null)
return false;
for (PositiveIntType v : this.informationSequence)
if (v.equals(value)) // positiveInt
if (v.getValue().equals(value)) // positiveInt
return true;
return false;
}

View File

@ -29,7 +29,7 @@ package org.hl7.fhir.r4.model;
*/
// Generated on Tue, Jan 9, 2018 14:51-0500 for FHIR v3.2.0
// Generated on Thu, Mar 1, 2018 20:26+1100 for FHIR v3.2.0
import java.util.*;
@ -175,6 +175,10 @@ public class ClaimResponse extends DomainResource {
}
public enum RemittanceOutcome {
/**
* The Claim/Pre-authorization/Pre-determination has been received but processing has not begun.
*/
RECEIVED,
/**
* The processing has completed without errors
*/
@ -194,6 +198,8 @@ public class ClaimResponse extends DomainResource {
public static RemittanceOutcome fromCode(String codeString) throws FHIRException {
if (codeString == null || "".equals(codeString))
return null;
if ("received".equals(codeString))
return RECEIVED;
if ("complete".equals(codeString))
return COMPLETE;
if ("error".equals(codeString))
@ -207,6 +213,7 @@ public class ClaimResponse extends DomainResource {
}
public String toCode() {
switch (this) {
case RECEIVED: return "received";
case COMPLETE: return "complete";
case ERROR: return "error";
case PARTIAL: return "partial";
@ -215,6 +222,7 @@ public class ClaimResponse extends DomainResource {
}
public String getSystem() {
switch (this) {
case RECEIVED: return "http://hl7.org/fhir/remittance-outcome";
case COMPLETE: return "http://hl7.org/fhir/remittance-outcome";
case ERROR: return "http://hl7.org/fhir/remittance-outcome";
case PARTIAL: return "http://hl7.org/fhir/remittance-outcome";
@ -223,6 +231,7 @@ public class ClaimResponse extends DomainResource {
}
public String getDefinition() {
switch (this) {
case RECEIVED: return "The Claim/Pre-authorization/Pre-determination has been received but processing has not begun.";
case COMPLETE: return "The processing has completed without errors";
case ERROR: return "One or more errors have been detected in the Claim";
case PARTIAL: return "No errors have been detected in the Claim and some of the adjudication has been performed.";
@ -231,6 +240,7 @@ public class ClaimResponse extends DomainResource {
}
public String getDisplay() {
switch (this) {
case RECEIVED: return "Received but not Processed";
case COMPLETE: return "Processing Complete";
case ERROR: return "Error";
case PARTIAL: return "Partial Processing";
@ -244,6 +254,8 @@ public class ClaimResponse extends DomainResource {
if (codeString == null || "".equals(codeString))
if (codeString == null || "".equals(codeString))
return null;
if ("received".equals(codeString))
return RemittanceOutcome.RECEIVED;
if ("complete".equals(codeString))
return RemittanceOutcome.COMPLETE;
if ("error".equals(codeString))
@ -260,6 +272,8 @@ public class ClaimResponse extends DomainResource {
String codeString = ((PrimitiveType) code).asStringValue();
if (codeString == null || "".equals(codeString))
return null;
if ("received".equals(codeString))
return new Enumeration<RemittanceOutcome>(this, RemittanceOutcome.RECEIVED);
if ("complete".equals(codeString))
return new Enumeration<RemittanceOutcome>(this, RemittanceOutcome.COMPLETE);
if ("error".equals(codeString))
@ -269,6 +283,8 @@ public class ClaimResponse extends DomainResource {
throw new FHIRException("Unknown RemittanceOutcome code '"+codeString+"'");
}
public String toCode(RemittanceOutcome code) {
if (code == RemittanceOutcome.RECEIVED)
return "received";
if (code == RemittanceOutcome.COMPLETE)
return "complete";
if (code == RemittanceOutcome.ERROR)
@ -430,7 +446,7 @@ public class ClaimResponse extends DomainResource {
if (this.noteNumber == null)
return false;
for (PositiveIntType v : this.noteNumber)
if (v.equals(value)) // positiveInt
if (v.getValue().equals(value)) // positiveInt
return true;
return false;
}
@ -1197,7 +1213,7 @@ public class ClaimResponse extends DomainResource {
if (this.noteNumber == null)
return false;
for (PositiveIntType v : this.noteNumber)
if (v.equals(value)) // positiveInt
if (v.getValue().equals(value)) // positiveInt
return true;
return false;
}
@ -1615,7 +1631,7 @@ public class ClaimResponse extends DomainResource {
if (this.noteNumber == null)
return false;
for (PositiveIntType v : this.noteNumber)
if (v.equals(value)) // positiveInt
if (v.getValue().equals(value)) // positiveInt
return true;
return false;
}
@ -1945,7 +1961,7 @@ public class ClaimResponse extends DomainResource {
if (this.itemSequence == null)
return false;
for (PositiveIntType v : this.itemSequence)
if (v.equals(value)) // positiveInt
if (v.getValue().equals(value)) // positiveInt
return true;
return false;
}
@ -2006,7 +2022,7 @@ public class ClaimResponse extends DomainResource {
if (this.detailSequence == null)
return false;
for (PositiveIntType v : this.detailSequence)
if (v.equals(value)) // positiveInt
if (v.getValue().equals(value)) // positiveInt
return true;
return false;
}
@ -2067,7 +2083,7 @@ public class ClaimResponse extends DomainResource {
if (this.subdetailSequence == null)
return false;
for (PositiveIntType v : this.subdetailSequence)
if (v.equals(value)) // positiveInt
if (v.getValue().equals(value)) // positiveInt
return true;
return false;
}
@ -2229,7 +2245,7 @@ public class ClaimResponse extends DomainResource {
if (this.noteNumber == null)
return false;
for (PositiveIntType v : this.noteNumber)
if (v.equals(value)) // positiveInt
if (v.getValue().equals(value)) // positiveInt
return true;
return false;
}
@ -3973,7 +3989,7 @@ public class ClaimResponse extends DomainResource {
if (this.preAuthRef == null)
return false;
for (StringType v : this.preAuthRef)
if (v.equals(value)) // string
if (v.getValue().equals(value)) // string
return true;
return false;
}
@ -4296,7 +4312,7 @@ public class ClaimResponse extends DomainResource {
* Transaction: error, complete, partial processing.
*/
@Child(name = "outcome", type = {CodeType.class}, order=8, min=0, max=1, modifier=false, summary=false)
@Description(shortDefinition="complete | error | partial", formalDefinition="Transaction: error, complete, partial processing." )
@Description(shortDefinition="received | complete | error | partial", formalDefinition="Transaction: error, complete, partial processing." )
@ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/remittance-outcome")
protected Enumeration<RemittanceOutcome> outcome;

View File

@ -29,7 +29,7 @@ package org.hl7.fhir.r4.model;
*/
// Generated on Tue, Jan 9, 2018 14:51-0500 for FHIR v3.2.0
// Generated on Thu, Mar 1, 2018 20:26+1100 for FHIR v3.2.0
import java.util.*;
@ -169,7 +169,7 @@ public class ClinicalImpression extends DomainResource {
/**
* A record of a specific investigation that was undertaken.
*/
@Child(name = "item", type = {Observation.class, QuestionnaireResponse.class, FamilyMemberHistory.class, DiagnosticReport.class, RiskAssessment.class, ImagingStudy.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
@Child(name = "item", type = {Observation.class, QuestionnaireResponse.class, FamilyMemberHistory.class, DiagnosticReport.class, RiskAssessment.class, ImagingStudy.class, Media.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
@Description(shortDefinition="Record of a specific investigation", formalDefinition="A record of a specific investigation that was undertaken." )
protected List<Reference> item;
/**
@ -285,14 +285,14 @@ public class ClinicalImpression extends DomainResource {
protected void listChildren(List<Property> children) {
super.listChildren(children);
children.add(new Property("code", "CodeableConcept", "A name/code for the group (\"set\") of investigations. Typically, this will be something like \"signs\", \"symptoms\", \"clinical\", \"diagnostic\", but the list is not constrained, and others such groups such as (exposure|family|travel|nutitirional) history may be used.", 0, 1, code));
children.add(new Property("item", "Reference(Observation|QuestionnaireResponse|FamilyMemberHistory|DiagnosticReport|RiskAssessment|ImagingStudy)", "A record of a specific investigation that was undertaken.", 0, java.lang.Integer.MAX_VALUE, item));
children.add(new Property("item", "Reference(Observation|QuestionnaireResponse|FamilyMemberHistory|DiagnosticReport|RiskAssessment|ImagingStudy|Media)", "A record of a specific investigation that was undertaken.", 0, java.lang.Integer.MAX_VALUE, item));
}
@Override
public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
switch (_hash) {
case 3059181: /*code*/ return new Property("code", "CodeableConcept", "A name/code for the group (\"set\") of investigations. Typically, this will be something like \"signs\", \"symptoms\", \"clinical\", \"diagnostic\", but the list is not constrained, and others such groups such as (exposure|family|travel|nutitirional) history may be used.", 0, 1, code);
case 3242771: /*item*/ return new Property("item", "Reference(Observation|QuestionnaireResponse|FamilyMemberHistory|DiagnosticReport|RiskAssessment|ImagingStudy)", "A record of a specific investigation that was undertaken.", 0, java.lang.Integer.MAX_VALUE, item);
case 3242771: /*item*/ return new Property("item", "Reference(Observation|QuestionnaireResponse|FamilyMemberHistory|DiagnosticReport|RiskAssessment|ImagingStudy|Media)", "A record of a specific investigation that was undertaken.", 0, java.lang.Integer.MAX_VALUE, item);
default: return super.getNamedProperty(_hash, _name, _checkValid);
}
@ -412,21 +412,33 @@ public class ClinicalImpression extends DomainResource {
@Block()
public static class ClinicalImpressionFindingComponent extends BackboneElement implements IBaseBackboneElement {
/**
* Specific text, code or reference for finding or diagnosis, which may include ruled-out or resolved conditions.
* Specific text or code for finding or diagnosis, which may include ruled-out or resolved conditions.
*/
@Child(name = "item", type = {CodeableConcept.class, Condition.class, Observation.class}, order=1, min=1, max=1, modifier=false, summary=false)
@Description(shortDefinition="What was found", formalDefinition="Specific text, code or reference for finding or diagnosis, which may include ruled-out or resolved conditions." )
@Child(name = "itemCodeableConcept", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=false)
@Description(shortDefinition="What was found", formalDefinition="Specific text or code for finding or diagnosis, which may include ruled-out or resolved conditions." )
@ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/condition-code")
protected Type item;
protected CodeableConcept itemCodeableConcept;
/**
* Specific reference for finding or diagnosis, which may include ruled-out or resolved conditions.
*/
@Child(name = "itemReference", type = {Condition.class, Observation.class, Media.class}, order=2, min=0, max=1, modifier=false, summary=false)
@Description(shortDefinition="What was found", formalDefinition="Specific reference for finding or diagnosis, which may include ruled-out or resolved conditions." )
protected Reference itemReference;
/**
* The actual object that is the target of the reference (Specific reference for finding or diagnosis, which may include ruled-out or resolved conditions.)
*/
protected Resource itemReferenceTarget;
/**
* Which investigations support finding or diagnosis.
*/
@Child(name = "basis", type = {StringType.class}, order=2, min=0, max=1, modifier=false, summary=false)
@Child(name = "basis", type = {StringType.class}, order=3, min=0, max=1, modifier=false, summary=false)
@Description(shortDefinition="Which investigations support finding", formalDefinition="Which investigations support finding or diagnosis." )
protected StringType basis;
private static final long serialVersionUID = 1690728236L;
private static final long serialVersionUID = -1578446448L;
/**
* Constructor
@ -435,56 +447,66 @@ public class ClinicalImpression extends DomainResource {
super();
}
/**
* Constructor
*/
public ClinicalImpressionFindingComponent(Type item) {
super();
this.item = item;
}
/**
* @return {@link #item} (Specific text, code or reference for finding or diagnosis, which may include ruled-out or resolved conditions.)
* @return {@link #itemCodeableConcept} (Specific text or code for finding or diagnosis, which may include ruled-out or resolved conditions.)
*/
public Type getItem() {
return this.item;
}
/**
* @return {@link #item} (Specific text, code or reference for finding or diagnosis, which may include ruled-out or resolved conditions.)
*/
public CodeableConcept getItemCodeableConcept() throws FHIRException {
if (!(this.item instanceof CodeableConcept))
throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.item.getClass().getName()+" was encountered");
return (CodeableConcept) this.item;
public CodeableConcept getItemCodeableConcept() {
if (this.itemCodeableConcept == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create ClinicalImpressionFindingComponent.itemCodeableConcept");
else if (Configuration.doAutoCreate())
this.itemCodeableConcept = new CodeableConcept(); // cc
return this.itemCodeableConcept;
}
public boolean hasItemCodeableConcept() {
return this.item instanceof CodeableConcept;
return this.itemCodeableConcept != null && !this.itemCodeableConcept.isEmpty();
}
/**
* @return {@link #item} (Specific text, code or reference for finding or diagnosis, which may include ruled-out or resolved conditions.)
* @param value {@link #itemCodeableConcept} (Specific text or code for finding or diagnosis, which may include ruled-out or resolved conditions.)
*/
public Reference getItemReference() throws FHIRException {
if (!(this.item instanceof Reference))
throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.item.getClass().getName()+" was encountered");
return (Reference) this.item;
public ClinicalImpressionFindingComponent setItemCodeableConcept(CodeableConcept value) {
this.itemCodeableConcept = value;
return this;
}
/**
* @return {@link #itemReference} (Specific reference for finding or diagnosis, which may include ruled-out or resolved conditions.)
*/
public Reference getItemReference() {
if (this.itemReference == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create ClinicalImpressionFindingComponent.itemReference");
else if (Configuration.doAutoCreate())
this.itemReference = new Reference(); // cc
return this.itemReference;
}
public boolean hasItemReference() {
return this.item instanceof Reference;
}
public boolean hasItem() {
return this.item != null && !this.item.isEmpty();
return this.itemReference != null && !this.itemReference.isEmpty();
}
/**
* @param value {@link #item} (Specific text, code or reference for finding or diagnosis, which may include ruled-out or resolved conditions.)
* @param value {@link #itemReference} (Specific reference for finding or diagnosis, which may include ruled-out or resolved conditions.)
*/
public ClinicalImpressionFindingComponent setItem(Type value) {
this.item = value;
public ClinicalImpressionFindingComponent setItemReference(Reference value) {
this.itemReference = value;
return this;
}
/**
* @return {@link #itemReference} 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. (Specific reference for finding or diagnosis, which may include ruled-out or resolved conditions.)
*/
public Resource getItemReferenceTarget() {
return this.itemReferenceTarget;
}
/**
* @param value {@link #itemReference} 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. (Specific reference for finding or diagnosis, which may include ruled-out or resolved conditions.)
*/
public ClinicalImpressionFindingComponent setItemReferenceTarget(Resource value) {
this.itemReferenceTarget = value;
return this;
}
@ -539,17 +561,16 @@ public class ClinicalImpression extends DomainResource {
protected void listChildren(List<Property> children) {
super.listChildren(children);
children.add(new Property("item[x]", "CodeableConcept|Reference(Condition|Observation)", "Specific text, code or reference for finding or diagnosis, which may include ruled-out or resolved conditions.", 0, 1, item));
children.add(new Property("itemCodeableConcept", "CodeableConcept", "Specific text or code for finding or diagnosis, which may include ruled-out or resolved conditions.", 0, 1, itemCodeableConcept));
children.add(new Property("itemReference", "Reference(Condition|Observation|Media)", "Specific reference for finding or diagnosis, which may include ruled-out or resolved conditions.", 0, 1, itemReference));
children.add(new Property("basis", "string", "Which investigations support finding or diagnosis.", 0, 1, basis));
}
@Override
public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
switch (_hash) {
case 2116201613: /*item[x]*/ return new Property("item[x]", "CodeableConcept|Reference(Condition|Observation)", "Specific text, code or reference for finding or diagnosis, which may include ruled-out or resolved conditions.", 0, 1, item);
case 3242771: /*item*/ return new Property("item[x]", "CodeableConcept|Reference(Condition|Observation)", "Specific text, code or reference for finding or diagnosis, which may include ruled-out or resolved conditions.", 0, 1, item);
case 106644494: /*itemCodeableConcept*/ return new Property("item[x]", "CodeableConcept|Reference(Condition|Observation)", "Specific text, code or reference for finding or diagnosis, which may include ruled-out or resolved conditions.", 0, 1, item);
case 1376364920: /*itemReference*/ return new Property("item[x]", "CodeableConcept|Reference(Condition|Observation)", "Specific text, code or reference for finding or diagnosis, which may include ruled-out or resolved conditions.", 0, 1, item);
case 106644494: /*itemCodeableConcept*/ return new Property("itemCodeableConcept", "CodeableConcept", "Specific text or code for finding or diagnosis, which may include ruled-out or resolved conditions.", 0, 1, itemCodeableConcept);
case 1376364920: /*itemReference*/ return new Property("itemReference", "Reference(Condition|Observation|Media)", "Specific reference for finding or diagnosis, which may include ruled-out or resolved conditions.", 0, 1, itemReference);
case 93508670: /*basis*/ return new Property("basis", "string", "Which investigations support finding or diagnosis.", 0, 1, basis);
default: return super.getNamedProperty(_hash, _name, _checkValid);
}
@ -559,7 +580,8 @@ public class ClinicalImpression extends DomainResource {
@Override
public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
switch (hash) {
case 3242771: /*item*/ return this.item == null ? new Base[0] : new Base[] {this.item}; // Type
case 106644494: /*itemCodeableConcept*/ return this.itemCodeableConcept == null ? new Base[0] : new Base[] {this.itemCodeableConcept}; // CodeableConcept
case 1376364920: /*itemReference*/ return this.itemReference == null ? new Base[0] : new Base[] {this.itemReference}; // Reference
case 93508670: /*basis*/ return this.basis == null ? new Base[0] : new Base[] {this.basis}; // StringType
default: return super.getProperty(hash, name, checkValid);
}
@ -569,8 +591,11 @@ public class ClinicalImpression extends DomainResource {
@Override
public Base setProperty(int hash, String name, Base value) throws FHIRException {
switch (hash) {
case 3242771: // item
this.item = castToType(value); // Type
case 106644494: // itemCodeableConcept
this.itemCodeableConcept = castToCodeableConcept(value); // CodeableConcept
return value;
case 1376364920: // itemReference
this.itemReference = castToReference(value); // Reference
return value;
case 93508670: // basis
this.basis = castToString(value); // StringType
@ -582,8 +607,10 @@ public class ClinicalImpression extends DomainResource {
@Override
public Base setProperty(String name, Base value) throws FHIRException {
if (name.equals("item[x]")) {
this.item = castToType(value); // Type
if (name.equals("itemCodeableConcept")) {
this.itemCodeableConcept = castToCodeableConcept(value); // CodeableConcept
} else if (name.equals("itemReference")) {
this.itemReference = castToReference(value); // Reference
} else if (name.equals("basis")) {
this.basis = castToString(value); // StringType
} else
@ -594,8 +621,8 @@ public class ClinicalImpression extends DomainResource {
@Override
public Base makeProperty(int hash, String name) throws FHIRException {
switch (hash) {
case 2116201613: return getItem();
case 3242771: return getItem();
case 106644494: return getItemCodeableConcept();
case 1376364920: return getItemReference();
case 93508670: return getBasisElement();
default: return super.makeProperty(hash, name);
}
@ -605,7 +632,8 @@ public class ClinicalImpression extends DomainResource {
@Override
public String[] getTypesForProperty(int hash, String name) throws FHIRException {
switch (hash) {
case 3242771: /*item*/ return new String[] {"CodeableConcept", "Reference"};
case 106644494: /*itemCodeableConcept*/ return new String[] {"CodeableConcept"};
case 1376364920: /*itemReference*/ return new String[] {"Reference"};
case 93508670: /*basis*/ return new String[] {"string"};
default: return super.getTypesForProperty(hash, name);
}
@ -615,12 +643,12 @@ public class ClinicalImpression extends DomainResource {
@Override
public Base addChild(String name) throws FHIRException {
if (name.equals("itemCodeableConcept")) {
this.item = new CodeableConcept();
return this.item;
this.itemCodeableConcept = new CodeableConcept();
return this.itemCodeableConcept;
}
else if (name.equals("itemReference")) {
this.item = new Reference();
return this.item;
this.itemReference = new Reference();
return this.itemReference;
}
else if (name.equals("basis")) {
throw new FHIRException("Cannot call addChild on a primitive type ClinicalImpression.basis");
@ -632,7 +660,8 @@ public class ClinicalImpression extends DomainResource {
public ClinicalImpressionFindingComponent copy() {
ClinicalImpressionFindingComponent dst = new ClinicalImpressionFindingComponent();
copyValues(dst);
dst.item = item == null ? null : item.copy();
dst.itemCodeableConcept = itemCodeableConcept == null ? null : itemCodeableConcept.copy();
dst.itemReference = itemReference == null ? null : itemReference.copy();
dst.basis = basis == null ? null : basis.copy();
return dst;
}
@ -644,7 +673,8 @@ public class ClinicalImpression extends DomainResource {
if (!(other_ instanceof ClinicalImpressionFindingComponent))
return false;
ClinicalImpressionFindingComponent o = (ClinicalImpressionFindingComponent) other_;
return compareDeep(item, o.item, true) && compareDeep(basis, o.basis, true);
return compareDeep(itemCodeableConcept, o.itemCodeableConcept, true) && compareDeep(itemReference, o.itemReference, true)
&& compareDeep(basis, o.basis, true);
}
@Override
@ -658,7 +688,8 @@ public class ClinicalImpression extends DomainResource {
}
public boolean isEmpty() {
return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(item, basis);
return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(itemCodeableConcept, itemReference
, basis);
}
public String fhirType() {
@ -1459,7 +1490,7 @@ public class ClinicalImpression extends DomainResource {
if (this.protocol == null)
return false;
for (UriType v : this.protocol)
if (v.equals(value)) // uri
if (v.getValue().equals(value)) // uri
return true;
return false;
}
@ -2310,17 +2341,17 @@ public class ClinicalImpression extends DomainResource {
* <p>
* Description: <b>What was found</b><br>
* Type: <b>token</b><br>
* Path: <b>ClinicalImpression.finding.item[x]</b><br>
* Path: <b>ClinicalImpression.finding.itemCodeableConcept</b><br>
* </p>
*/
@SearchParamDefinition(name="finding-code", path="ClinicalImpression.finding.item.as(CodeableConcept)", description="What was found", type="token" )
@SearchParamDefinition(name="finding-code", path="ClinicalImpression.finding.itemCodeableConcept", description="What was found", type="token" )
public static final String SP_FINDING_CODE = "finding-code";
/**
* <b>Fluent Client</b> search parameter constant for <b>finding-code</b>
* <p>
* Description: <b>What was found</b><br>
* Type: <b>token</b><br>
* Path: <b>ClinicalImpression.finding.item[x]</b><br>
* Path: <b>ClinicalImpression.finding.itemCodeableConcept</b><br>
* </p>
*/
public static final ca.uhn.fhir.rest.gclient.TokenClientParam FINDING_CODE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_FINDING_CODE);
@ -2382,17 +2413,17 @@ public class ClinicalImpression extends DomainResource {
* <p>
* Description: <b>What was found</b><br>
* Type: <b>reference</b><br>
* Path: <b>ClinicalImpression.finding.item[x]</b><br>
* Path: <b>ClinicalImpression.finding.itemReference</b><br>
* </p>
*/
@SearchParamDefinition(name="finding-ref", path="ClinicalImpression.finding.item.as(Reference)", description="What was found", type="reference", target={Condition.class, Observation.class } )
@SearchParamDefinition(name="finding-ref", path="ClinicalImpression.finding.itemReference", description="What was found", type="reference", target={Condition.class, Media.class, Observation.class } )
public static final String SP_FINDING_REF = "finding-ref";
/**
* <b>Fluent Client</b> search parameter constant for <b>finding-ref</b>
* <p>
* Description: <b>What was found</b><br>
* Type: <b>reference</b><br>
* Path: <b>ClinicalImpression.finding.item[x]</b><br>
* Path: <b>ClinicalImpression.finding.itemReference</b><br>
* </p>
*/
public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam FINDING_REF = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_FINDING_REF);
@ -2489,7 +2520,7 @@ public class ClinicalImpression extends DomainResource {
* Path: <b>ClinicalImpression.investigation.item</b><br>
* </p>
*/
@SearchParamDefinition(name="investigation", path="ClinicalImpression.investigation.item", description="Record of a specific investigation", type="reference", target={DiagnosticReport.class, FamilyMemberHistory.class, ImagingStudy.class, Observation.class, QuestionnaireResponse.class, RiskAssessment.class } )
@SearchParamDefinition(name="investigation", path="ClinicalImpression.investigation.item", description="Record of a specific investigation", type="reference", target={DiagnosticReport.class, FamilyMemberHistory.class, ImagingStudy.class, Media.class, Observation.class, QuestionnaireResponse.class, RiskAssessment.class } )
public static final String SP_INVESTIGATION = "investigation";
/**
* <b>Fluent Client</b> search parameter constant for <b>investigation</b>

View File

@ -29,7 +29,7 @@ package org.hl7.fhir.r4.model;
*/
// Generated on Tue, Jan 9, 2018 14:51-0500 for FHIR v3.2.0
// Generated on Thu, Mar 1, 2018 20:26+1100 for FHIR v3.2.0
import java.util.*;
@ -44,7 +44,7 @@ import ca.uhn.fhir.model.api.annotation.Block;
import org.hl7.fhir.instance.model.api.*;
import org.hl7.fhir.exceptions.FHIRException;
/**
* A code system resource specifies a set of codes drawn from one or more code systems.
* The CodeSystem resource is used to declare the existence of and describe a code system or code system supplement and its key properties, and optionally define a part or all of its content.
*/
@ResourceDef(name="CodeSystem", profile="http://hl7.org/fhir/Profile/CodeSystem")
@ChildOrder(names={"url", "identifier", "version", "name", "title", "status", "experimental", "date", "publisher", "contact", "description", "useContext", "jurisdiction", "purpose", "copyright", "caseSensitive", "valueSet", "hierarchyMeaning", "compositional", "versionNeeded", "content", "supplements", "count", "filter", "property", "concept"})
@ -2687,9 +2687,9 @@ public class CodeSystem extends MetadataResource {
/**
* Canonical URL of value set that contains the entire code system.
*/
@Child(name = "valueSet", type = {UriType.class}, order=4, min=0, max=1, modifier=false, summary=true)
@Child(name = "valueSet", type = {CanonicalType.class}, order=4, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="Canonical URL for value set with entire code system", formalDefinition="Canonical URL of value set that contains the entire code system." )
protected UriType valueSet;
protected CanonicalType valueSet;
/**
* The meaning of the hierarchy of concepts.
@ -2724,14 +2724,9 @@ public class CodeSystem extends MetadataResource {
/**
* Defines the code system that this code system supplement is adding designations and properties too.
*/
@Child(name = "supplements", type = {CodeSystem.class}, order=9, min=0, max=1, modifier=false, summary=true)
@Child(name = "supplements", type = {CanonicalType.class}, order=9, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="Code System this adds designations and properties to", formalDefinition="Defines the code system that this code system supplement is adding designations and properties too." )
protected Reference supplements;
/**
* The actual object that is the target of the reference (Defines the code system that this code system supplement is adding designations and properties too.)
*/
protected CodeSystem supplementsTarget;
protected CanonicalType supplements;
/**
* The total number of concepts defined by the code system. Where the code system has a compositional grammar, the count refers to the number of base (primitive) concepts.
@ -2761,7 +2756,7 @@ public class CodeSystem extends MetadataResource {
@Description(shortDefinition="Concepts in the code system", formalDefinition="Concepts that are in the code system. The concept definitions are inherently hierarchical, but the definitions must be consulted to determine what the meaning of the hierarchical relationships are." )
protected List<ConceptDefinitionComponent> concept;
private static final long serialVersionUID = -2068351364L;
private static final long serialVersionUID = 533217354L;
/**
* Constructor
@ -3541,12 +3536,12 @@ public class CodeSystem extends MetadataResource {
/**
* @return {@link #valueSet} (Canonical URL of value set that contains the entire code system.). This is the underlying object with id, value and extensions. The accessor "getValueSet" gives direct access to the value
*/
public UriType getValueSetElement() {
public CanonicalType getValueSetElement() {
if (this.valueSet == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create CodeSystem.valueSet");
else if (Configuration.doAutoCreate())
this.valueSet = new UriType(); // bb
this.valueSet = new CanonicalType(); // bb
return this.valueSet;
}
@ -3561,7 +3556,7 @@ public class CodeSystem extends MetadataResource {
/**
* @param value {@link #valueSet} (Canonical URL of value set that contains the entire code system.). This is the underlying object with id, value and extensions. The accessor "getValueSet" gives direct access to the value
*/
public CodeSystem setValueSetElement(UriType value) {
public CodeSystem setValueSetElement(CanonicalType value) {
this.valueSet = value;
return this;
}
@ -3581,7 +3576,7 @@ public class CodeSystem extends MetadataResource {
this.valueSet = null;
else {
if (this.valueSet == null)
this.valueSet = new UriType();
this.valueSet = new CanonicalType();
this.valueSet.setValue(value);
}
return this;
@ -3772,46 +3767,51 @@ public class CodeSystem extends MetadataResource {
}
/**
* @return {@link #supplements} (Defines the code system that this code system supplement is adding designations and properties too.)
* @return {@link #supplements} (Defines the code system that this code system supplement is adding designations and properties too.). This is the underlying object with id, value and extensions. The accessor "getSupplements" gives direct access to the value
*/
public Reference getSupplements() {
public CanonicalType getSupplementsElement() {
if (this.supplements == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create CodeSystem.supplements");
else if (Configuration.doAutoCreate())
this.supplements = new Reference(); // cc
this.supplements = new CanonicalType(); // bb
return this.supplements;
}
public boolean hasSupplementsElement() {
return this.supplements != null && !this.supplements.isEmpty();
}
public boolean hasSupplements() {
return this.supplements != null && !this.supplements.isEmpty();
}
/**
* @param value {@link #supplements} (Defines the code system that this code system supplement is adding designations and properties too.)
* @param value {@link #supplements} (Defines the code system that this code system supplement is adding designations and properties too.). This is the underlying object with id, value and extensions. The accessor "getSupplements" gives direct access to the value
*/
public CodeSystem setSupplements(Reference value) {
public CodeSystem setSupplementsElement(CanonicalType value) {
this.supplements = value;
return this;
}
/**
* @return {@link #supplements} 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. (Defines the code system that this code system supplement is adding designations and properties too.)
* @return Defines the code system that this code system supplement is adding designations and properties too.
*/
public CodeSystem getSupplementsTarget() {
if (this.supplementsTarget == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create CodeSystem.supplements");
else if (Configuration.doAutoCreate())
this.supplementsTarget = new CodeSystem(); // aa
return this.supplementsTarget;
public String getSupplements() {
return this.supplements == null ? null : this.supplements.getValue();
}
/**
* @param value {@link #supplements} 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. (Defines the code system that this code system supplement is adding designations and properties too.)
* @param value Defines the code system that this code system supplement is adding designations and properties too.
*/
public CodeSystem setSupplementsTarget(CodeSystem value) {
this.supplementsTarget = value;
public CodeSystem setSupplements(String value) {
if (Utilities.noString(value))
this.supplements = null;
else {
if (this.supplements == null)
this.supplements = new CanonicalType();
this.supplements.setValue(value);
}
return this;
}
@ -4037,12 +4037,12 @@ public class CodeSystem extends MetadataResource {
children.add(new Property("purpose", "markdown", "Explaination of why this code system is needed and why it has been designed as it has.", 0, 1, purpose));
children.add(new Property("copyright", "markdown", "A copyright statement relating to the code system and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the code system.", 0, 1, copyright));
children.add(new Property("caseSensitive", "boolean", "If code comparison is case sensitive when codes within this system are compared to each other.", 0, 1, caseSensitive));
children.add(new Property("valueSet", "uri", "Canonical URL of value set that contains the entire code system.", 0, 1, valueSet));
children.add(new Property("valueSet", "canonical(ValueSet)", "Canonical URL of value set that contains the entire code system.", 0, 1, valueSet));
children.add(new Property("hierarchyMeaning", "code", "The meaning of the hierarchy of concepts.", 0, 1, hierarchyMeaning));
children.add(new Property("compositional", "boolean", "True If code system defines a post-composition grammar.", 0, 1, compositional));
children.add(new Property("versionNeeded", "boolean", "This flag is used to signify that the code system has not (or does not) maintain the definitions, and a version must be specified when referencing this code system.", 0, 1, versionNeeded));
children.add(new Property("content", "code", "How much of the content of the code system - the concepts and codes it defines - are represented in this resource.", 0, 1, content));
children.add(new Property("supplements", "Reference(CodeSystem)", "Defines the code system that this code system supplement is adding designations and properties too.", 0, 1, supplements));
children.add(new Property("supplements", "canonical(CodeSystem)", "Defines the code system that this code system supplement is adding designations and properties too.", 0, 1, supplements));
children.add(new Property("count", "unsignedInt", "The total number of concepts defined by the code system. Where the code system has a compositional grammar, the count refers to the number of base (primitive) concepts.", 0, 1, count));
children.add(new Property("filter", "", "A filter that can be used in a value set compose statement when selecting concepts using a filter.", 0, java.lang.Integer.MAX_VALUE, filter));
children.add(new Property("property", "", "A property defines an additional slot through which additional information can be provided about a concept.", 0, java.lang.Integer.MAX_VALUE, property));
@ -4068,12 +4068,12 @@ public class CodeSystem extends MetadataResource {
case -220463842: /*purpose*/ return new Property("purpose", "markdown", "Explaination of why this code system is needed and why it has been designed as it has.", 0, 1, purpose);
case 1522889671: /*copyright*/ return new Property("copyright", "markdown", "A copyright statement relating to the code system and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the code system.", 0, 1, copyright);
case -35616442: /*caseSensitive*/ return new Property("caseSensitive", "boolean", "If code comparison is case sensitive when codes within this system are compared to each other.", 0, 1, caseSensitive);
case -1410174671: /*valueSet*/ return new Property("valueSet", "uri", "Canonical URL of value set that contains the entire code system.", 0, 1, valueSet);
case -1410174671: /*valueSet*/ return new Property("valueSet", "canonical(ValueSet)", "Canonical URL of value set that contains the entire code system.", 0, 1, valueSet);
case 1913078280: /*hierarchyMeaning*/ return new Property("hierarchyMeaning", "code", "The meaning of the hierarchy of concepts.", 0, 1, hierarchyMeaning);
case 1248023381: /*compositional*/ return new Property("compositional", "boolean", "True If code system defines a post-composition grammar.", 0, 1, compositional);
case 617270957: /*versionNeeded*/ return new Property("versionNeeded", "boolean", "This flag is used to signify that the code system has not (or does not) maintain the definitions, and a version must be specified when referencing this code system.", 0, 1, versionNeeded);
case 951530617: /*content*/ return new Property("content", "code", "How much of the content of the code system - the concepts and codes it defines - are represented in this resource.", 0, 1, content);
case -596951334: /*supplements*/ return new Property("supplements", "Reference(CodeSystem)", "Defines the code system that this code system supplement is adding designations and properties too.", 0, 1, supplements);
case -596951334: /*supplements*/ return new Property("supplements", "canonical(CodeSystem)", "Defines the code system that this code system supplement is adding designations and properties too.", 0, 1, supplements);
case 94851343: /*count*/ return new Property("count", "unsignedInt", "The total number of concepts defined by the code system. Where the code system has a compositional grammar, the count refers to the number of base (primitive) concepts.", 0, 1, count);
case -1274492040: /*filter*/ return new Property("filter", "", "A filter that can be used in a value set compose statement when selecting concepts using a filter.", 0, java.lang.Integer.MAX_VALUE, filter);
case -993141291: /*property*/ return new Property("property", "", "A property defines an additional slot through which additional information can be provided about a concept.", 0, java.lang.Integer.MAX_VALUE, property);
@ -4102,12 +4102,12 @@ public class CodeSystem extends MetadataResource {
case -220463842: /*purpose*/ return this.purpose == null ? new Base[0] : new Base[] {this.purpose}; // MarkdownType
case 1522889671: /*copyright*/ return this.copyright == null ? new Base[0] : new Base[] {this.copyright}; // MarkdownType
case -35616442: /*caseSensitive*/ return this.caseSensitive == null ? new Base[0] : new Base[] {this.caseSensitive}; // BooleanType
case -1410174671: /*valueSet*/ return this.valueSet == null ? new Base[0] : new Base[] {this.valueSet}; // UriType
case -1410174671: /*valueSet*/ return this.valueSet == null ? new Base[0] : new Base[] {this.valueSet}; // CanonicalType
case 1913078280: /*hierarchyMeaning*/ return this.hierarchyMeaning == null ? new Base[0] : new Base[] {this.hierarchyMeaning}; // Enumeration<CodeSystemHierarchyMeaning>
case 1248023381: /*compositional*/ return this.compositional == null ? new Base[0] : new Base[] {this.compositional}; // BooleanType
case 617270957: /*versionNeeded*/ return this.versionNeeded == null ? new Base[0] : new Base[] {this.versionNeeded}; // BooleanType
case 951530617: /*content*/ return this.content == null ? new Base[0] : new Base[] {this.content}; // Enumeration<CodeSystemContentMode>
case -596951334: /*supplements*/ return this.supplements == null ? new Base[0] : new Base[] {this.supplements}; // Reference
case -596951334: /*supplements*/ return this.supplements == null ? new Base[0] : new Base[] {this.supplements}; // CanonicalType
case 94851343: /*count*/ return this.count == null ? new Base[0] : new Base[] {this.count}; // UnsignedIntType
case -1274492040: /*filter*/ return this.filter == null ? new Base[0] : this.filter.toArray(new Base[this.filter.size()]); // CodeSystemFilterComponent
case -993141291: /*property*/ return this.property == null ? new Base[0] : this.property.toArray(new Base[this.property.size()]); // PropertyComponent
@ -4170,7 +4170,7 @@ public class CodeSystem extends MetadataResource {
this.caseSensitive = castToBoolean(value); // BooleanType
return value;
case -1410174671: // valueSet
this.valueSet = castToUri(value); // UriType
this.valueSet = castToCanonical(value); // CanonicalType
return value;
case 1913078280: // hierarchyMeaning
value = new CodeSystemHierarchyMeaningEnumFactory().fromType(castToCode(value));
@ -4187,7 +4187,7 @@ public class CodeSystem extends MetadataResource {
this.content = (Enumeration) value; // Enumeration<CodeSystemContentMode>
return value;
case -596951334: // supplements
this.supplements = castToReference(value); // Reference
this.supplements = castToCanonical(value); // CanonicalType
return value;
case 94851343: // count
this.count = castToUnsignedInt(value); // UnsignedIntType
@ -4242,7 +4242,7 @@ public class CodeSystem extends MetadataResource {
} else if (name.equals("caseSensitive")) {
this.caseSensitive = castToBoolean(value); // BooleanType
} else if (name.equals("valueSet")) {
this.valueSet = castToUri(value); // UriType
this.valueSet = castToCanonical(value); // CanonicalType
} else if (name.equals("hierarchyMeaning")) {
value = new CodeSystemHierarchyMeaningEnumFactory().fromType(castToCode(value));
this.hierarchyMeaning = (Enumeration) value; // Enumeration<CodeSystemHierarchyMeaning>
@ -4254,7 +4254,7 @@ public class CodeSystem extends MetadataResource {
value = new CodeSystemContentModeEnumFactory().fromType(castToCode(value));
this.content = (Enumeration) value; // Enumeration<CodeSystemContentMode>
} else if (name.equals("supplements")) {
this.supplements = castToReference(value); // Reference
this.supplements = castToCanonical(value); // CanonicalType
} else if (name.equals("count")) {
this.count = castToUnsignedInt(value); // UnsignedIntType
} else if (name.equals("filter")) {
@ -4292,7 +4292,7 @@ public class CodeSystem extends MetadataResource {
case 1248023381: return getCompositionalElement();
case 617270957: return getVersionNeededElement();
case 951530617: return getContentElement();
case -596951334: return getSupplements();
case -596951334: return getSupplementsElement();
case 94851343: return getCountElement();
case -1274492040: return addFilter();
case -993141291: return addProperty();
@ -4321,12 +4321,12 @@ public class CodeSystem extends MetadataResource {
case -220463842: /*purpose*/ return new String[] {"markdown"};
case 1522889671: /*copyright*/ return new String[] {"markdown"};
case -35616442: /*caseSensitive*/ return new String[] {"boolean"};
case -1410174671: /*valueSet*/ return new String[] {"uri"};
case -1410174671: /*valueSet*/ return new String[] {"canonical"};
case 1913078280: /*hierarchyMeaning*/ return new String[] {"code"};
case 1248023381: /*compositional*/ return new String[] {"boolean"};
case 617270957: /*versionNeeded*/ return new String[] {"boolean"};
case 951530617: /*content*/ return new String[] {"code"};
case -596951334: /*supplements*/ return new String[] {"Reference"};
case -596951334: /*supplements*/ return new String[] {"canonical"};
case 94851343: /*count*/ return new String[] {"unsignedInt"};
case -1274492040: /*filter*/ return new String[] {};
case -993141291: /*property*/ return new String[] {};
@ -4403,8 +4403,7 @@ public class CodeSystem extends MetadataResource {
throw new FHIRException("Cannot call addChild on a primitive type CodeSystem.content");
}
else if (name.equals("supplements")) {
this.supplements = new Reference();
return this.supplements;
throw new FHIRException("Cannot call addChild on a primitive type CodeSystem.supplements");
}
else if (name.equals("count")) {
throw new FHIRException("Cannot call addChild on a primitive type CodeSystem.count");
@ -4510,9 +4509,9 @@ public class CodeSystem extends MetadataResource {
return false;
CodeSystem o = (CodeSystem) other_;
return compareValues(purpose, o.purpose, true) && compareValues(copyright, o.copyright, true) && compareValues(caseSensitive, o.caseSensitive, true)
&& compareValues(valueSet, o.valueSet, true) && compareValues(hierarchyMeaning, o.hierarchyMeaning, true)
&& compareValues(compositional, o.compositional, true) && compareValues(versionNeeded, o.versionNeeded, true)
&& compareValues(content, o.content, true) && compareValues(count, o.count, true);
&& compareValues(hierarchyMeaning, o.hierarchyMeaning, true) && compareValues(compositional, o.compositional, true)
&& compareValues(versionNeeded, o.versionNeeded, true) && compareValues(content, o.content, true) && compareValues(count, o.count, true)
;
}
public boolean isEmpty() {

View File

@ -29,7 +29,7 @@ package org.hl7.fhir.r4.model;
*/
// Generated on Tue, Jan 9, 2018 14:51-0500 for FHIR v3.2.0
// Generated on Thu, Mar 1, 2018 20:26+1100 for FHIR v3.2.0
import java.util.*;

View File

@ -29,7 +29,7 @@ package org.hl7.fhir.r4.model;
*/
// Generated on Tue, Jan 9, 2018 14:51-0500 for FHIR v3.2.0
// Generated on Thu, Mar 1, 2018 20:26+1100 for FHIR v3.2.0
import java.util.*;

View File

@ -29,7 +29,7 @@ package org.hl7.fhir.r4.model;
*/
// Generated on Tue, Jan 9, 2018 14:51-0500 for FHIR v3.2.0
// Generated on Thu, Mar 1, 2018 20:26+1100 for FHIR v3.2.0
import java.util.*;
@ -685,6 +685,7 @@ public class Communication extends DomainResource {
*/
@Child(name = "topic", type = {CodeableConcept.class}, order=12, min=0, max=1, modifier=false, summary=false)
@Description(shortDefinition="Description of the purpose/content", formalDefinition="Description of the purpose/content, similar to a subject line in an email." )
@ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/communication-topic")
protected CodeableConcept topic;
/**
@ -897,7 +898,7 @@ public class Communication extends DomainResource {
if (this.instantiates == null)
return false;
for (UriType v : this.instantiates)
if (v.equals(value)) // uri
if (v.getValue().equals(value)) // uri
return true;
return false;
}

View File

@ -29,7 +29,7 @@ package org.hl7.fhir.r4.model;
*/
// Generated on Tue, Jan 9, 2018 14:51-0500 for FHIR v3.2.0
// Generated on Thu, Mar 1, 2018 20:26+1100 for FHIR v3.2.0
import java.util.*;

View File

@ -29,7 +29,7 @@ package org.hl7.fhir.r4.model;
*/
// Generated on Tue, Jan 9, 2018 14:51-0500 for FHIR v3.2.0
// Generated on Thu, Mar 1, 2018 20:26+1100 for FHIR v3.2.0
import java.util.*;
@ -332,7 +332,7 @@ public class CompartmentDefinition extends MetadataResource {
if (this.param == null)
return false;
for (StringType v : this.param)
if (v.equals(value)) // string
if (v.getValue().equals(value)) // string
return true;
return false;
}

View File

@ -29,7 +29,7 @@ package org.hl7.fhir.r4.model;
*/
// Generated on Tue, Jan 9, 2018 14:51-0500 for FHIR v3.2.0
// Generated on Thu, Mar 1, 2018 20:26+1100 for FHIR v3.2.0
import java.util.*;
@ -43,7 +43,7 @@ import ca.uhn.fhir.model.api.annotation.Block;
import org.hl7.fhir.instance.model.api.*;
import org.hl7.fhir.exceptions.FHIRException;
/**
* A set of healthcare-related information that is assembled together into a single logical document that provides a single coherent statement of meaning, establishes its own context and that has clinical attestation with regard to who is making the statement. While a Composition defines the structure, it does not actually contain the content: rather the full content of a document is contained in a Bundle, of which the Composition is the first resource contained.
* A set of healthcare-related information that is assembled together into a single logical package that provides a single coherent statement of meaning, establishes its own context and that has clinical attestation with regard to who is making the statement. A Composition defines the structure and narrative content necessary for a document. However, a Composition alone does not constitute a document. Rather, the Composition must be the first entry in a Bundle where Bundle.type=document, and any other resources referenced from Composition must be included as subsequent entries in the Bundle (for example Patient, Practitioner, Encounter, etc.).
*/
@ResourceDef(name="Composition", profile="http://hl7.org/fhir/Profile/Composition")
public class Composition extends DomainResource {
@ -689,10 +689,10 @@ public class Composition extends DomainResource {
/**
* The type of attestation the authenticator offers.
*/
@Child(name = "mode", type = {CodeType.class}, order=1, min=1, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
@Child(name = "mode", type = {CodeType.class}, order=1, min=1, max=1, modifier=false, summary=true)
@Description(shortDefinition="personal | professional | legal | official", formalDefinition="The type of attestation the authenticator offers." )
@ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/composition-attestation-mode")
protected List<Enumeration<CompositionAttestationMode>> mode;
protected Enumeration<CompositionAttestationMode> mode;
/**
* When the composition was attested by the party.
@ -704,7 +704,7 @@ public class Composition extends DomainResource {
/**
* Who attested the composition in the specified way.
*/
@Child(name = "party", type = {Patient.class, Practitioner.class, PractitionerRole.class, Organization.class}, order=3, min=0, max=1, modifier=false, summary=true)
@Child(name = "party", type = {Patient.class, RelatedPerson.class, Practitioner.class, PractitionerRole.class, Organization.class}, order=3, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="Who attested the composition", formalDefinition="Who attested the composition in the specified way." )
protected Reference party;
@ -713,7 +713,7 @@ public class Composition extends DomainResource {
*/
protected Resource partyTarget;
private static final long serialVersionUID = -436604745L;
private static final long serialVersionUID = -1917768205L;
/**
* Constructor
@ -722,65 +722,57 @@ public class Composition extends DomainResource {
super();
}
/**
* Constructor
*/
public CompositionAttesterComponent(Enumeration<CompositionAttestationMode> mode) {
super();
this.mode = mode;
}
/**
* @return {@link #mode} (The type of attestation the authenticator offers.)
* @return {@link #mode} (The type of attestation the authenticator offers.). This is the underlying object with id, value and extensions. The accessor "getMode" gives direct access to the value
*/
public List<Enumeration<CompositionAttestationMode>> getMode() {
public Enumeration<CompositionAttestationMode> getModeElement() {
if (this.mode == null)
this.mode = new ArrayList<Enumeration<CompositionAttestationMode>>();
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create CompositionAttesterComponent.mode");
else if (Configuration.doAutoCreate())
this.mode = new Enumeration<CompositionAttestationMode>(new CompositionAttestationModeEnumFactory()); // bb
return this.mode;
}
/**
* @return Returns a reference to <code>this</code> for easy method chaining
*/
public CompositionAttesterComponent setMode(List<Enumeration<CompositionAttestationMode>> theMode) {
this.mode = theMode;
return this;
public boolean hasModeElement() {
return this.mode != null && !this.mode.isEmpty();
}
public boolean hasMode() {
if (this.mode == null)
return false;
for (Enumeration<CompositionAttestationMode> item : this.mode)
if (!item.isEmpty())
return true;
return false;
return this.mode != null && !this.mode.isEmpty();
}
/**
* @return {@link #mode} (The type of attestation the authenticator offers.)
* @param value {@link #mode} (The type of attestation the authenticator offers.). This is the underlying object with id, value and extensions. The accessor "getMode" gives direct access to the value
*/
public Enumeration<CompositionAttestationMode> addModeElement() {//2
Enumeration<CompositionAttestationMode> t = new Enumeration<CompositionAttestationMode>(new CompositionAttestationModeEnumFactory());
if (this.mode == null)
this.mode = new ArrayList<Enumeration<CompositionAttestationMode>>();
this.mode.add(t);
return t;
}
/**
* @param value {@link #mode} (The type of attestation the authenticator offers.)
*/
public CompositionAttesterComponent addMode(CompositionAttestationMode value) { //1
Enumeration<CompositionAttestationMode> t = new Enumeration<CompositionAttestationMode>(new CompositionAttestationModeEnumFactory());
t.setValue(value);
if (this.mode == null)
this.mode = new ArrayList<Enumeration<CompositionAttestationMode>>();
this.mode.add(t);
public CompositionAttesterComponent setModeElement(Enumeration<CompositionAttestationMode> value) {
this.mode = value;
return this;
}
/**
* @param value {@link #mode} (The type of attestation the authenticator offers.)
* @return The type of attestation the authenticator offers.
*/
public boolean hasMode(CompositionAttestationMode value) {
if (this.mode == null)
return false;
for (Enumeration<CompositionAttestationMode> v : this.mode)
if (v.getValue().equals(value)) // code
return true;
return false;
public CompositionAttestationMode getMode() {
return this.mode == null ? null : this.mode.getValue();
}
/**
* @param value The type of attestation the authenticator offers.
*/
public CompositionAttesterComponent setMode(CompositionAttestationMode value) {
if (this.mode == null)
this.mode = new Enumeration<CompositionAttestationMode>(new CompositionAttestationModeEnumFactory());
this.mode.setValue(value);
return this;
}
/**
@ -873,17 +865,17 @@ public class Composition extends DomainResource {
protected void listChildren(List<Property> children) {
super.listChildren(children);
children.add(new Property("mode", "code", "The type of attestation the authenticator offers.", 0, java.lang.Integer.MAX_VALUE, mode));
children.add(new Property("mode", "code", "The type of attestation the authenticator offers.", 0, 1, mode));
children.add(new Property("time", "dateTime", "When the composition was attested by the party.", 0, 1, time));
children.add(new Property("party", "Reference(Patient|Practitioner|PractitionerRole|Organization)", "Who attested the composition in the specified way.", 0, 1, party));
children.add(new Property("party", "Reference(Patient|RelatedPerson|Practitioner|PractitionerRole|Organization)", "Who attested the composition in the specified way.", 0, 1, party));
}
@Override
public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
switch (_hash) {
case 3357091: /*mode*/ return new Property("mode", "code", "The type of attestation the authenticator offers.", 0, java.lang.Integer.MAX_VALUE, mode);
case 3357091: /*mode*/ return new Property("mode", "code", "The type of attestation the authenticator offers.", 0, 1, mode);
case 3560141: /*time*/ return new Property("time", "dateTime", "When the composition was attested by the party.", 0, 1, time);
case 106437350: /*party*/ return new Property("party", "Reference(Patient|Practitioner|PractitionerRole|Organization)", "Who attested the composition in the specified way.", 0, 1, party);
case 106437350: /*party*/ return new Property("party", "Reference(Patient|RelatedPerson|Practitioner|PractitionerRole|Organization)", "Who attested the composition in the specified way.", 0, 1, party);
default: return super.getNamedProperty(_hash, _name, _checkValid);
}
@ -892,7 +884,7 @@ public class Composition extends DomainResource {
@Override
public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
switch (hash) {
case 3357091: /*mode*/ return this.mode == null ? new Base[0] : this.mode.toArray(new Base[this.mode.size()]); // Enumeration<CompositionAttestationMode>
case 3357091: /*mode*/ return this.mode == null ? new Base[0] : new Base[] {this.mode}; // Enumeration<CompositionAttestationMode>
case 3560141: /*time*/ return this.time == null ? new Base[0] : new Base[] {this.time}; // DateTimeType
case 106437350: /*party*/ return this.party == null ? new Base[0] : new Base[] {this.party}; // Reference
default: return super.getProperty(hash, name, checkValid);
@ -905,7 +897,7 @@ public class Composition extends DomainResource {
switch (hash) {
case 3357091: // mode
value = new CompositionAttestationModeEnumFactory().fromType(castToCode(value));
this.getMode().add((Enumeration) value); // Enumeration<CompositionAttestationMode>
this.mode = (Enumeration) value; // Enumeration<CompositionAttestationMode>
return value;
case 3560141: // time
this.time = castToDateTime(value); // DateTimeType
@ -922,7 +914,7 @@ public class Composition extends DomainResource {
public Base setProperty(String name, Base value) throws FHIRException {
if (name.equals("mode")) {
value = new CompositionAttestationModeEnumFactory().fromType(castToCode(value));
this.getMode().add((Enumeration) value);
this.mode = (Enumeration) value; // Enumeration<CompositionAttestationMode>
} else if (name.equals("time")) {
this.time = castToDateTime(value); // DateTimeType
} else if (name.equals("party")) {
@ -935,7 +927,7 @@ public class Composition extends DomainResource {
@Override
public Base makeProperty(int hash, String name) throws FHIRException {
switch (hash) {
case 3357091: return addModeElement();
case 3357091: return getModeElement();
case 3560141: return getTimeElement();
case 106437350: return getParty();
default: return super.makeProperty(hash, name);
@ -973,11 +965,7 @@ public class Composition extends DomainResource {
public CompositionAttesterComponent copy() {
CompositionAttesterComponent dst = new CompositionAttesterComponent();
copyValues(dst);
if (mode != null) {
dst.mode = new ArrayList<Enumeration<CompositionAttestationMode>>();
for (Enumeration<CompositionAttestationMode> i : mode)
dst.mode.add(i.copy());
};
dst.mode = mode == null ? null : mode.copy();
dst.time = time == null ? null : time.copy();
dst.party = party == null ? null : party.copy();
return dst;
@ -1614,17 +1602,29 @@ public class Composition extends DomainResource {
@ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/doc-section-codes")
protected CodeableConcept code;
/**
* Identifies who is responsible for the information in this section, not necessarily who typed it in.
*/
@Child(name = "author", type = {Practitioner.class, PractitionerRole.class, Device.class, Patient.class, RelatedPerson.class, Organization.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
@Description(shortDefinition="Who and/or what authored the section", formalDefinition="Identifies who is responsible for the information in this section, not necessarily who typed it in." )
protected List<Reference> author;
/**
* The actual objects that are the target of the reference (Identifies who is responsible for the information in this section, not necessarily who typed it in.)
*/
protected List<Resource> authorTarget;
/**
* A human-readable narrative that contains the attested content of the section, used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative.
*/
@Child(name = "text", type = {Narrative.class}, order=3, min=0, max=1, modifier=false, summary=false)
@Child(name = "text", type = {Narrative.class}, order=4, min=0, max=1, modifier=false, summary=false)
@Description(shortDefinition="Text summary of the section, for human interpretation", formalDefinition="A human-readable narrative that contains the attested content of the section, used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it \"clinically safe\" for a human to just read the narrative." )
protected Narrative text;
/**
* How the entry list was prepared - whether it is a working list that is suitable for being maintained on an ongoing basis, or if it represents a snapshot of a list of items from another source, or whether it is a prepared list where items may be marked as added, modified or deleted.
*/
@Child(name = "mode", type = {CodeType.class}, order=4, min=0, max=1, modifier=true, summary=true)
@Child(name = "mode", type = {CodeType.class}, order=5, min=0, max=1, modifier=true, summary=true)
@Description(shortDefinition="working | snapshot | changes", formalDefinition="How the entry list was prepared - whether it is a working list that is suitable for being maintained on an ongoing basis, or if it represents a snapshot of a list of items from another source, or whether it is a prepared list where items may be marked as added, modified or deleted." )
@ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/list-mode")
protected Enumeration<SectionMode> mode;
@ -1632,7 +1632,7 @@ public class Composition extends DomainResource {
/**
* Specifies the order applied to the items in the section entries.
*/
@Child(name = "orderedBy", type = {CodeableConcept.class}, order=5, min=0, max=1, modifier=false, summary=false)
@Child(name = "orderedBy", type = {CodeableConcept.class}, order=6, min=0, max=1, modifier=false, summary=false)
@Description(shortDefinition="Order of section entries", formalDefinition="Specifies the order applied to the items in the section entries." )
@ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/list-order")
protected CodeableConcept orderedBy;
@ -1640,7 +1640,7 @@ public class Composition extends DomainResource {
/**
* A reference to the actual resource from which the narrative in the section is derived.
*/
@Child(name = "entry", type = {Reference.class}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
@Child(name = "entry", type = {Reference.class}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
@Description(shortDefinition="A reference to data that supports this section", formalDefinition="A reference to the actual resource from which the narrative in the section is derived." )
protected List<Reference> entry;
/**
@ -1652,7 +1652,7 @@ public class Composition extends DomainResource {
/**
* If the section is empty, why the list is empty. An empty section typically has some text explaining the empty reason.
*/
@Child(name = "emptyReason", type = {CodeableConcept.class}, order=7, min=0, max=1, modifier=false, summary=false)
@Child(name = "emptyReason", type = {CodeableConcept.class}, order=8, min=0, max=1, modifier=false, summary=false)
@Description(shortDefinition="Why the section is empty", formalDefinition="If the section is empty, why the list is empty. An empty section typically has some text explaining the empty reason." )
@ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/list-empty-reason")
protected CodeableConcept emptyReason;
@ -1660,11 +1660,11 @@ public class Composition extends DomainResource {
/**
* A nested sub-section within this section.
*/
@Child(name = "section", type = {SectionComponent.class}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
@Child(name = "section", type = {SectionComponent.class}, order=9, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
@Description(shortDefinition="Nested Section", formalDefinition="A nested sub-section within this section." )
protected List<SectionComponent> section;
private static final long serialVersionUID = -128426142L;
private static final long serialVersionUID = 2045983012L;
/**
* Constructor
@ -1746,6 +1746,69 @@ public class Composition extends DomainResource {
return this;
}
/**
* @return {@link #author} (Identifies who is responsible for the information in this section, not necessarily who typed it in.)
*/
public List<Reference> getAuthor() {
if (this.author == null)
this.author = new ArrayList<Reference>();
return this.author;
}
/**
* @return Returns a reference to <code>this</code> for easy method chaining
*/
public SectionComponent setAuthor(List<Reference> theAuthor) {
this.author = theAuthor;
return this;
}
public boolean hasAuthor() {
if (this.author == null)
return false;
for (Reference item : this.author)
if (!item.isEmpty())
return true;
return false;
}
public Reference addAuthor() { //3
Reference t = new Reference();
if (this.author == null)
this.author = new ArrayList<Reference>();
this.author.add(t);
return t;
}
public SectionComponent addAuthor(Reference t) { //3
if (t == null)
return this;
if (this.author == null)
this.author = new ArrayList<Reference>();
this.author.add(t);
return this;
}
/**
* @return The first repetition of repeating field {@link #author}, creating it if it does not already exist
*/
public Reference getAuthorFirstRep() {
if (getAuthor().isEmpty()) {
addAuthor();
}
return getAuthor().get(0);
}
/**
* @deprecated Use Reference#setResource(IBaseResource) instead
*/
@Deprecated
public List<Resource> getAuthorTarget() {
if (this.authorTarget == null)
this.authorTarget = new ArrayList<Resource>();
return this.authorTarget;
}
/**
* @return {@link #text} (A human-readable narrative that contains the attested content of the section, used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative.)
*/
@ -1987,6 +2050,7 @@ public class Composition extends DomainResource {
super.listChildren(children);
children.add(new Property("title", "string", "The label for this particular section. This will be part of the rendered content for the document, and is often used to build a table of contents.", 0, 1, title));
children.add(new Property("code", "CodeableConcept", "A code identifying the kind of content contained within the section. This must be consistent with the section title.", 0, 1, code));
children.add(new Property("author", "Reference(Practitioner|PractitionerRole|Device|Patient|RelatedPerson|Organization)", "Identifies who is responsible for the information in this section, not necessarily who typed it in.", 0, java.lang.Integer.MAX_VALUE, author));
children.add(new Property("text", "Narrative", "A human-readable narrative that contains the attested content of the section, used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it \"clinically safe\" for a human to just read the narrative.", 0, 1, text));
children.add(new Property("mode", "code", "How the entry list was prepared - whether it is a working list that is suitable for being maintained on an ongoing basis, or if it represents a snapshot of a list of items from another source, or whether it is a prepared list where items may be marked as added, modified or deleted.", 0, 1, mode));
children.add(new Property("orderedBy", "CodeableConcept", "Specifies the order applied to the items in the section entries.", 0, 1, orderedBy));
@ -2000,6 +2064,7 @@ public class Composition extends DomainResource {
switch (_hash) {
case 110371416: /*title*/ return new Property("title", "string", "The label for this particular section. This will be part of the rendered content for the document, and is often used to build a table of contents.", 0, 1, title);
case 3059181: /*code*/ return new Property("code", "CodeableConcept", "A code identifying the kind of content contained within the section. This must be consistent with the section title.", 0, 1, code);
case -1406328437: /*author*/ return new Property("author", "Reference(Practitioner|PractitionerRole|Device|Patient|RelatedPerson|Organization)", "Identifies who is responsible for the information in this section, not necessarily who typed it in.", 0, java.lang.Integer.MAX_VALUE, author);
case 3556653: /*text*/ return new Property("text", "Narrative", "A human-readable narrative that contains the attested content of the section, used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it \"clinically safe\" for a human to just read the narrative.", 0, 1, text);
case 3357091: /*mode*/ return new Property("mode", "code", "How the entry list was prepared - whether it is a working list that is suitable for being maintained on an ongoing basis, or if it represents a snapshot of a list of items from another source, or whether it is a prepared list where items may be marked as added, modified or deleted.", 0, 1, mode);
case -391079516: /*orderedBy*/ return new Property("orderedBy", "CodeableConcept", "Specifies the order applied to the items in the section entries.", 0, 1, orderedBy);
@ -2016,6 +2081,7 @@ public class Composition extends DomainResource {
switch (hash) {
case 110371416: /*title*/ return this.title == null ? new Base[0] : new Base[] {this.title}; // StringType
case 3059181: /*code*/ return this.code == null ? new Base[0] : new Base[] {this.code}; // CodeableConcept
case -1406328437: /*author*/ return this.author == null ? new Base[0] : this.author.toArray(new Base[this.author.size()]); // Reference
case 3556653: /*text*/ return this.text == null ? new Base[0] : new Base[] {this.text}; // Narrative
case 3357091: /*mode*/ return this.mode == null ? new Base[0] : new Base[] {this.mode}; // Enumeration<SectionMode>
case -391079516: /*orderedBy*/ return this.orderedBy == null ? new Base[0] : new Base[] {this.orderedBy}; // CodeableConcept
@ -2036,6 +2102,9 @@ public class Composition extends DomainResource {
case 3059181: // code
this.code = castToCodeableConcept(value); // CodeableConcept
return value;
case -1406328437: // author
this.getAuthor().add(castToReference(value)); // Reference
return value;
case 3556653: // text
this.text = castToNarrative(value); // Narrative
return value;
@ -2066,6 +2135,8 @@ public class Composition extends DomainResource {
this.title = castToString(value); // StringType
} else if (name.equals("code")) {
this.code = castToCodeableConcept(value); // CodeableConcept
} else if (name.equals("author")) {
this.getAuthor().add(castToReference(value));
} else if (name.equals("text")) {
this.text = castToNarrative(value); // Narrative
} else if (name.equals("mode")) {
@ -2089,6 +2160,7 @@ public class Composition extends DomainResource {
switch (hash) {
case 110371416: return getTitleElement();
case 3059181: return getCode();
case -1406328437: return addAuthor();
case 3556653: return getText();
case 3357091: return getModeElement();
case -391079516: return getOrderedBy();
@ -2105,6 +2177,7 @@ public class Composition extends DomainResource {
switch (hash) {
case 110371416: /*title*/ return new String[] {"string"};
case 3059181: /*code*/ return new String[] {"CodeableConcept"};
case -1406328437: /*author*/ return new String[] {"Reference"};
case 3556653: /*text*/ return new String[] {"Narrative"};
case 3357091: /*mode*/ return new String[] {"code"};
case -391079516: /*orderedBy*/ return new String[] {"CodeableConcept"};
@ -2125,6 +2198,9 @@ public class Composition extends DomainResource {
this.code = new CodeableConcept();
return this.code;
}
else if (name.equals("author")) {
return addAuthor();
}
else if (name.equals("text")) {
this.text = new Narrative();
return this.text;
@ -2155,6 +2231,11 @@ public class Composition extends DomainResource {
copyValues(dst);
dst.title = title == null ? null : title.copy();
dst.code = code == null ? null : code.copy();
if (author != null) {
dst.author = new ArrayList<Reference>();
for (Reference i : author)
dst.author.add(i.copy());
};
dst.text = text == null ? null : text.copy();
dst.mode = mode == null ? null : mode.copy();
dst.orderedBy = orderedBy == null ? null : orderedBy.copy();
@ -2179,9 +2260,10 @@ public class Composition extends DomainResource {
if (!(other_ instanceof SectionComponent))
return false;
SectionComponent o = (SectionComponent) other_;
return compareDeep(title, o.title, true) && compareDeep(code, o.code, true) && compareDeep(text, o.text, true)
&& compareDeep(mode, o.mode, true) && compareDeep(orderedBy, o.orderedBy, true) && compareDeep(entry, o.entry, true)
&& compareDeep(emptyReason, o.emptyReason, true) && compareDeep(section, o.section, true);
return compareDeep(title, o.title, true) && compareDeep(code, o.code, true) && compareDeep(author, o.author, true)
&& compareDeep(text, o.text, true) && compareDeep(mode, o.mode, true) && compareDeep(orderedBy, o.orderedBy, true)
&& compareDeep(entry, o.entry, true) && compareDeep(emptyReason, o.emptyReason, true) && compareDeep(section, o.section, true)
;
}
@Override
@ -2195,8 +2277,8 @@ public class Composition extends DomainResource {
}
public boolean isEmpty() {
return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(title, code, text, mode
, orderedBy, entry, emptyReason, section);
return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(title, code, author, text
, mode, orderedBy, entry, emptyReason, section);
}
public String fhirType() {
@ -2207,10 +2289,10 @@ public class Composition extends DomainResource {
}
/**
* Logical identifier for the composition, assigned when created. This identifier stays constant as the composition is changed over time.
* A version-independent identifier for the Composition. This identifier stays constant as the composition is changed over time.
*/
@Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="Logical identifier of composition (version-independent)", formalDefinition="Logical identifier for the composition, assigned when created. This identifier stays constant as the composition is changed over time." )
@Description(shortDefinition="Version-independent identifier for the Composition", formalDefinition="A version-independent identifier for the Composition. This identifier stays constant as the composition is changed over time." )
protected Identifier identifier;
/**
@ -2356,7 +2438,7 @@ public class Composition extends DomainResource {
}
/**
* @return {@link #identifier} (Logical identifier for the composition, assigned when created. This identifier stays constant as the composition is changed over time.)
* @return {@link #identifier} (A version-independent identifier for the Composition. This identifier stays constant as the composition is changed over time.)
*/
public Identifier getIdentifier() {
if (this.identifier == null)
@ -2372,7 +2454,7 @@ public class Composition extends DomainResource {
}
/**
* @param value {@link #identifier} (Logical identifier for the composition, assigned when created. This identifier stays constant as the composition is changed over time.)
* @param value {@link #identifier} (A version-independent identifier for the Composition. This identifier stays constant as the composition is changed over time.)
*/
public Composition setIdentifier(Identifier value) {
this.identifier = value;
@ -3015,7 +3097,7 @@ public class Composition extends DomainResource {
protected void listChildren(List<Property> children) {
super.listChildren(children);
children.add(new Property("identifier", "Identifier", "Logical identifier for the composition, assigned when created. This identifier stays constant as the composition is changed over time.", 0, 1, identifier));
children.add(new Property("identifier", "Identifier", "A version-independent identifier for the Composition. This identifier stays constant as the composition is changed over time.", 0, 1, identifier));
children.add(new Property("status", "code", "The workflow/clinical status of this composition. The status is a marker for the clinical standing of the document.", 0, 1, status));
children.add(new Property("type", "CodeableConcept", "Specifies the particular kind of composition (e.g. History and Physical, Discharge Summary, Progress Note). This usually equates to the purpose of making the composition.", 0, 1, type));
children.add(new Property("class", "CodeableConcept", "A categorization for the type of the composition - helps for indexing and searching. This may be implied by or derived from the code specified in the Composition Type.", 0, 1, class_));
@ -3035,7 +3117,7 @@ public class Composition extends DomainResource {
@Override
public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
switch (_hash) {
case -1618432855: /*identifier*/ return new Property("identifier", "Identifier", "Logical identifier for the composition, assigned when created. This identifier stays constant as the composition is changed over time.", 0, 1, identifier);
case -1618432855: /*identifier*/ return new Property("identifier", "Identifier", "A version-independent identifier for the Composition. This identifier stays constant as the composition is changed over time.", 0, 1, identifier);
case -892481550: /*status*/ return new Property("status", "code", "The workflow/clinical status of this composition. The status is a marker for the clinical standing of the document.", 0, 1, status);
case 3575610: /*type*/ return new Property("type", "CodeableConcept", "Specifies the particular kind of composition (e.g. History and Physical, Discharge Summary, Progress Note). This usually equates to the purpose of making the composition.", 0, 1, type);
case 94742904: /*class*/ return new Property("class", "CodeableConcept", "A categorization for the type of the composition - helps for indexing and searching. This may be implied by or derived from the code specified in the Composition Type.", 0, 1, class_);
@ -3385,17 +3467,17 @@ public class Composition extends DomainResource {
/**
* Search parameter: <b>identifier</b>
* <p>
* Description: <b>Logical identifier of composition (version-independent)</b><br>
* Description: <b>Version-independent identifier for the Composition</b><br>
* Type: <b>token</b><br>
* Path: <b>Composition.identifier</b><br>
* </p>
*/
@SearchParamDefinition(name="identifier", path="Composition.identifier", description="Logical identifier of composition (version-independent)", type="token" )
@SearchParamDefinition(name="identifier", path="Composition.identifier", description="Version-independent identifier for the Composition", type="token" )
public static final String SP_IDENTIFIER = "identifier";
/**
* <b>Fluent Client</b> search parameter constant for <b>identifier</b>
* <p>
* Description: <b>Logical identifier of composition (version-independent)</b><br>
* Description: <b>Version-independent identifier for the Composition</b><br>
* Type: <b>token</b><br>
* Path: <b>Composition.identifier</b><br>
* </p>
@ -3608,7 +3690,7 @@ public class Composition extends DomainResource {
* Path: <b>Composition.attester.party</b><br>
* </p>
*/
@SearchParamDefinition(name="attester", path="Composition.attester.party", description="Who attested the composition", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Patient"), @ca.uhn.fhir.model.api.annotation.Compartment(name="Practitioner") }, target={Organization.class, Patient.class, Practitioner.class, PractitionerRole.class } )
@SearchParamDefinition(name="attester", path="Composition.attester.party", description="Who attested the composition", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Patient"), @ca.uhn.fhir.model.api.annotation.Compartment(name="Practitioner") }, target={Organization.class, Patient.class, Practitioner.class, PractitionerRole.class, RelatedPerson.class } )
public static final String SP_ATTESTER = "attester";
/**
* <b>Fluent Client</b> search parameter constant for <b>attester</b>

View File

@ -29,7 +29,7 @@ package org.hl7.fhir.r4.model;
*/
// Generated on Tue, Jan 9, 2018 14:51-0500 for FHIR v3.2.0
// Generated on Thu, Mar 1, 2018 20:26+1100 for FHIR v3.2.0
import java.util.*;
@ -1014,7 +1014,7 @@ public class ConceptMap extends MetadataResource {
/**
* The equivalence between the source and target concepts (counting for the dependencies and products). The equivalence is read from target to source (e.g. the target is 'wider' than the source).
*/
@Child(name = "equivalence", type = {CodeType.class}, order=3, min=0, max=1, modifier=true, summary=false)
@Child(name = "equivalence", type = {CodeType.class}, order=3, min=1, max=1, modifier=true, summary=false)
@Description(shortDefinition="relatedto | equivalent | equal | wider | subsumes | narrower | specializes | inexact | unmatched | disjoint", formalDefinition="The equivalence between the source and target concepts (counting for the dependencies and products). The equivalence is read from target to source (e.g. the target is 'wider' than the source)." )
@ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/concept-map-equivalence")
protected Enumeration<ConceptMapEquivalence> equivalence;
@ -1049,6 +1049,14 @@ public class ConceptMap extends MetadataResource {
super();
}
/**
* Constructor
*/
public TargetElementComponent(Enumeration<ConceptMapEquivalence> equivalence) {
super();
this.equivalence = equivalence;
}
/**
* @return {@link #code} (Identity (code or path) or the element/item that the map refers to.). This is the underlying object with id, value and extensions. The accessor "getCode" gives direct access to the value
*/
@ -1186,13 +1194,9 @@ public class ConceptMap extends MetadataResource {
* @param value The equivalence between the source and target concepts (counting for the dependencies and products). The equivalence is read from target to source (e.g. the target is 'wider' than the source).
*/
public TargetElementComponent setEquivalence(ConceptMapEquivalence value) {
if (value == null)
this.equivalence = null;
else {
if (this.equivalence == null)
this.equivalence = new Enumeration<ConceptMapEquivalence>(new ConceptMapEquivalenceEnumFactory());
this.equivalence.setValue(value);
}
return this;
}
@ -1555,9 +1559,9 @@ public class ConceptMap extends MetadataResource {
/**
* An absolute URI that identifies the code system of the dependency code (if the source/dependency is a value set that crosses code systems).
*/
@Child(name = "system", type = {UriType.class}, order=2, min=0, max=1, modifier=false, summary=false)
@Child(name = "system", type = {CanonicalType.class}, order=2, min=0, max=1, modifier=false, summary=false)
@Description(shortDefinition="Code System (if necessary)", formalDefinition="An absolute URI that identifies the code system of the dependency code (if the source/dependency is a value set that crosses code systems)." )
protected UriType system;
protected CanonicalType system;
/**
* Identity (code or path) or the element/item/ValueSet that the map depends on / refers to.
@ -1573,7 +1577,7 @@ public class ConceptMap extends MetadataResource {
@Description(shortDefinition="Display for the code", formalDefinition="The display for the code. The display is only provided to help editors when editing the concept map." )
protected StringType display;
private static final long serialVersionUID = 678887659L;
private static final long serialVersionUID = 1597034403L;
/**
* Constructor
@ -1639,12 +1643,12 @@ public class ConceptMap extends MetadataResource {
/**
* @return {@link #system} (An absolute URI that identifies the code system of the dependency code (if the source/dependency is a value set that crosses code systems).). This is the underlying object with id, value and extensions. The accessor "getSystem" gives direct access to the value
*/
public UriType getSystemElement() {
public CanonicalType getSystemElement() {
if (this.system == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create OtherElementComponent.system");
else if (Configuration.doAutoCreate())
this.system = new UriType(); // bb
this.system = new CanonicalType(); // bb
return this.system;
}
@ -1659,7 +1663,7 @@ public class ConceptMap extends MetadataResource {
/**
* @param value {@link #system} (An absolute URI that identifies the code system of the dependency code (if the source/dependency is a value set that crosses code systems).). This is the underlying object with id, value and extensions. The accessor "getSystem" gives direct access to the value
*/
public OtherElementComponent setSystemElement(UriType value) {
public OtherElementComponent setSystemElement(CanonicalType value) {
this.system = value;
return this;
}
@ -1679,7 +1683,7 @@ public class ConceptMap extends MetadataResource {
this.system = null;
else {
if (this.system == null)
this.system = new UriType();
this.system = new CanonicalType();
this.system.setValue(value);
}
return this;
@ -1782,7 +1786,7 @@ public class ConceptMap extends MetadataResource {
protected void listChildren(List<Property> children) {
super.listChildren(children);
children.add(new Property("property", "uri", "A reference to an element that holds a coded value that corresponds to a code system property. The idea is that the information model carries an element somwhere that is labeled to correspond with a code system property.", 0, 1, property));
children.add(new Property("system", "uri", "An absolute URI that identifies the code system of the dependency code (if the source/dependency is a value set that crosses code systems).", 0, 1, system));
children.add(new Property("system", "canonical(CodeSystem)", "An absolute URI that identifies the code system of the dependency code (if the source/dependency is a value set that crosses code systems).", 0, 1, system));
children.add(new Property("code", "string", "Identity (code or path) or the element/item/ValueSet that the map depends on / refers to.", 0, 1, code));
children.add(new Property("display", "string", "The display for the code. The display is only provided to help editors when editing the concept map.", 0, 1, display));
}
@ -1791,7 +1795,7 @@ public class ConceptMap extends MetadataResource {
public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
switch (_hash) {
case -993141291: /*property*/ return new Property("property", "uri", "A reference to an element that holds a coded value that corresponds to a code system property. The idea is that the information model carries an element somwhere that is labeled to correspond with a code system property.", 0, 1, property);
case -887328209: /*system*/ return new Property("system", "uri", "An absolute URI that identifies the code system of the dependency code (if the source/dependency is a value set that crosses code systems).", 0, 1, system);
case -887328209: /*system*/ return new Property("system", "canonical(CodeSystem)", "An absolute URI that identifies the code system of the dependency code (if the source/dependency is a value set that crosses code systems).", 0, 1, system);
case 3059181: /*code*/ return new Property("code", "string", "Identity (code or path) or the element/item/ValueSet that the map depends on / refers to.", 0, 1, code);
case 1671764162: /*display*/ return new Property("display", "string", "The display for the code. The display is only provided to help editors when editing the concept map.", 0, 1, display);
default: return super.getNamedProperty(_hash, _name, _checkValid);
@ -1803,7 +1807,7 @@ public class ConceptMap extends MetadataResource {
public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
switch (hash) {
case -993141291: /*property*/ return this.property == null ? new Base[0] : new Base[] {this.property}; // UriType
case -887328209: /*system*/ return this.system == null ? new Base[0] : new Base[] {this.system}; // UriType
case -887328209: /*system*/ return this.system == null ? new Base[0] : new Base[] {this.system}; // CanonicalType
case 3059181: /*code*/ return this.code == null ? new Base[0] : new Base[] {this.code}; // StringType
case 1671764162: /*display*/ return this.display == null ? new Base[0] : new Base[] {this.display}; // StringType
default: return super.getProperty(hash, name, checkValid);
@ -1818,7 +1822,7 @@ public class ConceptMap extends MetadataResource {
this.property = castToUri(value); // UriType
return value;
case -887328209: // system
this.system = castToUri(value); // UriType
this.system = castToCanonical(value); // CanonicalType
return value;
case 3059181: // code
this.code = castToString(value); // StringType
@ -1836,7 +1840,7 @@ public class ConceptMap extends MetadataResource {
if (name.equals("property")) {
this.property = castToUri(value); // UriType
} else if (name.equals("system")) {
this.system = castToUri(value); // UriType
this.system = castToCanonical(value); // CanonicalType
} else if (name.equals("code")) {
this.code = castToString(value); // StringType
} else if (name.equals("display")) {
@ -1862,7 +1866,7 @@ public class ConceptMap extends MetadataResource {
public String[] getTypesForProperty(int hash, String name) throws FHIRException {
switch (hash) {
case -993141291: /*property*/ return new String[] {"uri"};
case -887328209: /*system*/ return new String[] {"uri"};
case -887328209: /*system*/ return new String[] {"canonical"};
case 3059181: /*code*/ return new String[] {"string"};
case 1671764162: /*display*/ return new String[] {"string"};
default: return super.getTypesForProperty(hash, name);
@ -1916,8 +1920,8 @@ public class ConceptMap extends MetadataResource {
if (!(other_ instanceof OtherElementComponent))
return false;
OtherElementComponent o = (OtherElementComponent) other_;
return compareValues(property, o.property, true) && compareValues(system, o.system, true) && compareValues(code, o.code, true)
&& compareValues(display, o.display, true);
return compareValues(property, o.property, true) && compareValues(code, o.code, true) && compareValues(display, o.display, true)
;
}
public boolean isEmpty() {
@ -1959,11 +1963,11 @@ public class ConceptMap extends MetadataResource {
/**
* The canonical URL of the map to use if this map contains no mapping.
*/
@Child(name = "url", type = {UriType.class}, order=4, min=0, max=1, modifier=false, summary=false)
@Child(name = "url", type = {CanonicalType.class}, order=4, min=0, max=1, modifier=false, summary=false)
@Description(shortDefinition="Canonical URL for other concept map", formalDefinition="The canonical URL of the map to use if this map contains no mapping." )
protected UriType url;
protected CanonicalType url;
private static final long serialVersionUID = -482446774L;
private static final long serialVersionUID = 1261364354L;
/**
* Constructor
@ -2126,12 +2130,12 @@ public class ConceptMap extends MetadataResource {
/**
* @return {@link #url} (The canonical URL of the map to use if this map contains no mapping.). This is the underlying object with id, value and extensions. The accessor "getUrl" gives direct access to the value
*/
public UriType getUrlElement() {
public CanonicalType getUrlElement() {
if (this.url == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create ConceptMapGroupUnmappedComponent.url");
else if (Configuration.doAutoCreate())
this.url = new UriType(); // bb
this.url = new CanonicalType(); // bb
return this.url;
}
@ -2146,7 +2150,7 @@ public class ConceptMap extends MetadataResource {
/**
* @param value {@link #url} (The canonical URL of the map to use if this map contains no mapping.). This is the underlying object with id, value and extensions. The accessor "getUrl" gives direct access to the value
*/
public ConceptMapGroupUnmappedComponent setUrlElement(UriType value) {
public ConceptMapGroupUnmappedComponent setUrlElement(CanonicalType value) {
this.url = value;
return this;
}
@ -2166,7 +2170,7 @@ public class ConceptMap extends MetadataResource {
this.url = null;
else {
if (this.url == null)
this.url = new UriType();
this.url = new CanonicalType();
this.url.setValue(value);
}
return this;
@ -2177,7 +2181,7 @@ public class ConceptMap extends MetadataResource {
children.add(new Property("mode", "code", "Defines which action to take if there is no match in the group. One of 3 actions is possible: use the unmapped code (this is useful when doing a mapping between versions, and only a few codes have changed), use a fixed code (a default code), or alternatively, a reference to a different concept map can be provided (by canonical URL).", 0, 1, mode));
children.add(new Property("code", "code", "The fixed code to use when the mode = 'fixed' - all unmapped codes are mapped to a single fixed code.", 0, 1, code));
children.add(new Property("display", "string", "The display for the code. The display is only provided to help editors when editing the concept map.", 0, 1, display));
children.add(new Property("url", "uri", "The canonical URL of the map to use if this map contains no mapping.", 0, 1, url));
children.add(new Property("url", "canonical(ConceptMap)", "The canonical URL of the map to use if this map contains no mapping.", 0, 1, url));
}
@Override
@ -2186,7 +2190,7 @@ public class ConceptMap extends MetadataResource {
case 3357091: /*mode*/ return new Property("mode", "code", "Defines which action to take if there is no match in the group. One of 3 actions is possible: use the unmapped code (this is useful when doing a mapping between versions, and only a few codes have changed), use a fixed code (a default code), or alternatively, a reference to a different concept map can be provided (by canonical URL).", 0, 1, mode);
case 3059181: /*code*/ return new Property("code", "code", "The fixed code to use when the mode = 'fixed' - all unmapped codes are mapped to a single fixed code.", 0, 1, code);
case 1671764162: /*display*/ return new Property("display", "string", "The display for the code. The display is only provided to help editors when editing the concept map.", 0, 1, display);
case 116079: /*url*/ return new Property("url", "uri", "The canonical URL of the map to use if this map contains no mapping.", 0, 1, url);
case 116079: /*url*/ return new Property("url", "canonical(ConceptMap)", "The canonical URL of the map to use if this map contains no mapping.", 0, 1, url);
default: return super.getNamedProperty(_hash, _name, _checkValid);
}
@ -2198,7 +2202,7 @@ public class ConceptMap extends MetadataResource {
case 3357091: /*mode*/ return this.mode == null ? new Base[0] : new Base[] {this.mode}; // Enumeration<ConceptMapGroupUnmappedMode>
case 3059181: /*code*/ return this.code == null ? new Base[0] : new Base[] {this.code}; // CodeType
case 1671764162: /*display*/ return this.display == null ? new Base[0] : new Base[] {this.display}; // StringType
case 116079: /*url*/ return this.url == null ? new Base[0] : new Base[] {this.url}; // UriType
case 116079: /*url*/ return this.url == null ? new Base[0] : new Base[] {this.url}; // CanonicalType
default: return super.getProperty(hash, name, checkValid);
}
@ -2218,7 +2222,7 @@ public class ConceptMap extends MetadataResource {
this.display = castToString(value); // StringType
return value;
case 116079: // url
this.url = castToUri(value); // UriType
this.url = castToCanonical(value); // CanonicalType
return value;
default: return super.setProperty(hash, name, value);
}
@ -2235,7 +2239,7 @@ public class ConceptMap extends MetadataResource {
} else if (name.equals("display")) {
this.display = castToString(value); // StringType
} else if (name.equals("url")) {
this.url = castToUri(value); // UriType
this.url = castToCanonical(value); // CanonicalType
} else
return super.setProperty(name, value);
return value;
@ -2259,7 +2263,7 @@ public class ConceptMap extends MetadataResource {
case 3357091: /*mode*/ return new String[] {"code"};
case 3059181: /*code*/ return new String[] {"code"};
case 1671764162: /*display*/ return new String[] {"string"};
case 116079: /*url*/ return new String[] {"uri"};
case 116079: /*url*/ return new String[] {"canonical"};
default: return super.getTypesForProperty(hash, name);
}
@ -2312,7 +2316,7 @@ public class ConceptMap extends MetadataResource {
return false;
ConceptMapGroupUnmappedComponent o = (ConceptMapGroupUnmappedComponent) other_;
return compareValues(mode, o.mode, true) && compareValues(code, o.code, true) && compareValues(display, o.display, true)
&& compareValues(url, o.url, true);
;
}
public boolean isEmpty() {
@ -2351,14 +2355,14 @@ public class ConceptMap extends MetadataResource {
/**
* The source value set that specifies the concepts that are being mapped.
*/
@Child(name = "source", type = {UriType.class, ValueSet.class}, order=3, min=0, max=1, modifier=false, summary=true)
@Child(name = "source", type = {UriType.class, CanonicalType.class}, order=3, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="Identifies the source of the concepts which are being mapped", formalDefinition="The source value set that specifies the concepts that are being mapped." )
protected Type source;
/**
* The target value set provides context to the mappings. Note that the mapping is made between concepts, not between value sets, but the value set provides important context about how the concept mapping choices are made.
*/
@Child(name = "target", type = {UriType.class, ValueSet.class}, order=4, min=0, max=1, modifier=false, summary=true)
@Child(name = "target", type = {UriType.class, CanonicalType.class}, order=4, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="Provides context to the mappings", formalDefinition="The target value set provides context to the mappings. Note that the mapping is made between concepts, not between value sets, but the value set provides important context about how the concept mapping choices are made." )
protected Type target;
@ -3123,14 +3127,14 @@ public class ConceptMap extends MetadataResource {
/**
* @return {@link #source} (The source value set that specifies the concepts that are being mapped.)
*/
public Reference getSourceReference() throws FHIRException {
if (!(this.source instanceof Reference))
throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.source.getClass().getName()+" was encountered");
return (Reference) this.source;
public CanonicalType getSourceCanonicalType() throws FHIRException {
if (!(this.source instanceof CanonicalType))
throw new FHIRException("Type mismatch: the type CanonicalType was expected, but "+this.source.getClass().getName()+" was encountered");
return (CanonicalType) this.source;
}
public boolean hasSourceReference() {
return this.source instanceof Reference;
public boolean hasSourceCanonicalType() {
return this.source instanceof CanonicalType;
}
public boolean hasSource() {
@ -3168,14 +3172,14 @@ public class ConceptMap extends MetadataResource {
/**
* @return {@link #target} (The target value set provides context to the mappings. Note that the mapping is made between concepts, not between value sets, but the value set provides important context about how the concept mapping choices are made.)
*/
public Reference getTargetReference() throws FHIRException {
if (!(this.target instanceof Reference))
throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.target.getClass().getName()+" was encountered");
return (Reference) this.target;
public CanonicalType getTargetCanonicalType() throws FHIRException {
if (!(this.target instanceof CanonicalType))
throw new FHIRException("Type mismatch: the type CanonicalType was expected, but "+this.target.getClass().getName()+" was encountered");
return (CanonicalType) this.target;
}
public boolean hasTargetReference() {
return this.target instanceof Reference;
public boolean hasTargetCanonicalType() {
return this.target instanceof CanonicalType;
}
public boolean hasTarget() {
@ -3260,8 +3264,8 @@ public class ConceptMap extends MetadataResource {
children.add(new Property("jurisdiction", "CodeableConcept", "A legal or geographic region in which the concept map is intended to be used.", 0, java.lang.Integer.MAX_VALUE, jurisdiction));
children.add(new Property("purpose", "markdown", "Explaination of why this concept map is needed and why it has been designed as it has.", 0, 1, purpose));
children.add(new Property("copyright", "markdown", "A copyright statement relating to the concept map and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the concept map.", 0, 1, copyright));
children.add(new Property("source[x]", "uri|Reference(ValueSet)", "The source value set that specifies the concepts that are being mapped.", 0, 1, source));
children.add(new Property("target[x]", "uri|Reference(ValueSet)", "The target value set provides context to the mappings. Note that the mapping is made between concepts, not between value sets, but the value set provides important context about how the concept mapping choices are made.", 0, 1, target));
children.add(new Property("source[x]", "uri|canonical(ValueSet)", "The source value set that specifies the concepts that are being mapped.", 0, 1, source));
children.add(new Property("target[x]", "uri|canonical(ValueSet)", "The target value set provides context to the mappings. Note that the mapping is made between concepts, not between value sets, but the value set provides important context about how the concept mapping choices are made.", 0, 1, target));
children.add(new Property("group", "", "A group of mappings that all have the same source and target system.", 0, java.lang.Integer.MAX_VALUE, group));
}
@ -3283,14 +3287,14 @@ public class ConceptMap extends MetadataResource {
case -507075711: /*jurisdiction*/ return new Property("jurisdiction", "CodeableConcept", "A legal or geographic region in which the concept map is intended to be used.", 0, java.lang.Integer.MAX_VALUE, jurisdiction);
case -220463842: /*purpose*/ return new Property("purpose", "markdown", "Explaination of why this concept map is needed and why it has been designed as it has.", 0, 1, purpose);
case 1522889671: /*copyright*/ return new Property("copyright", "markdown", "A copyright statement relating to the concept map and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the concept map.", 0, 1, copyright);
case -1698413947: /*source[x]*/ return new Property("source[x]", "uri|Reference(ValueSet)", "The source value set that specifies the concepts that are being mapped.", 0, 1, source);
case -896505829: /*source*/ return new Property("source[x]", "uri|Reference(ValueSet)", "The source value set that specifies the concepts that are being mapped.", 0, 1, source);
case -1698419887: /*sourceUri*/ return new Property("source[x]", "uri|Reference(ValueSet)", "The source value set that specifies the concepts that are being mapped.", 0, 1, source);
case -244259472: /*sourceReference*/ return new Property("source[x]", "uri|Reference(ValueSet)", "The source value set that specifies the concepts that are being mapped.", 0, 1, source);
case -815579825: /*target[x]*/ return new Property("target[x]", "uri|Reference(ValueSet)", "The target value set provides context to the mappings. Note that the mapping is made between concepts, not between value sets, but the value set provides important context about how the concept mapping choices are made.", 0, 1, target);
case -880905839: /*target*/ return new Property("target[x]", "uri|Reference(ValueSet)", "The target value set provides context to the mappings. Note that the mapping is made between concepts, not between value sets, but the value set provides important context about how the concept mapping choices are made.", 0, 1, target);
case -815585765: /*targetUri*/ return new Property("target[x]", "uri|Reference(ValueSet)", "The target value set provides context to the mappings. Note that the mapping is made between concepts, not between value sets, but the value set provides important context about how the concept mapping choices are made.", 0, 1, target);
case 1259806906: /*targetReference*/ return new Property("target[x]", "uri|Reference(ValueSet)", "The target value set provides context to the mappings. Note that the mapping is made between concepts, not between value sets, but the value set provides important context about how the concept mapping choices are made.", 0, 1, target);
case -1698413947: /*source[x]*/ return new Property("source[x]", "uri|canonical(ValueSet)", "The source value set that specifies the concepts that are being mapped.", 0, 1, source);
case -896505829: /*source*/ return new Property("source[x]", "uri|canonical(ValueSet)", "The source value set that specifies the concepts that are being mapped.", 0, 1, source);
case -1698419887: /*sourceUri*/ return new Property("source[x]", "uri|canonical(ValueSet)", "The source value set that specifies the concepts that are being mapped.", 0, 1, source);
case 1509247769: /*sourceCanonical*/ return new Property("source[x]", "uri|canonical(ValueSet)", "The source value set that specifies the concepts that are being mapped.", 0, 1, source);
case -815579825: /*target[x]*/ return new Property("target[x]", "uri|canonical(ValueSet)", "The target value set provides context to the mappings. Note that the mapping is made between concepts, not between value sets, but the value set provides important context about how the concept mapping choices are made.", 0, 1, target);
case -880905839: /*target*/ return new Property("target[x]", "uri|canonical(ValueSet)", "The target value set provides context to the mappings. Note that the mapping is made between concepts, not between value sets, but the value set provides important context about how the concept mapping choices are made.", 0, 1, target);
case -815585765: /*targetUri*/ return new Property("target[x]", "uri|canonical(ValueSet)", "The target value set provides context to the mappings. Note that the mapping is made between concepts, not between value sets, but the value set provides important context about how the concept mapping choices are made.", 0, 1, target);
case -1281653149: /*targetCanonical*/ return new Property("target[x]", "uri|canonical(ValueSet)", "The target value set provides context to the mappings. Note that the mapping is made between concepts, not between value sets, but the value set provides important context about how the concept mapping choices are made.", 0, 1, target);
case 98629247: /*group*/ return new Property("group", "", "A group of mappings that all have the same source and target system.", 0, java.lang.Integer.MAX_VALUE, group);
default: return super.getNamedProperty(_hash, _name, _checkValid);
}
@ -3476,8 +3480,8 @@ public class ConceptMap extends MetadataResource {
case -507075711: /*jurisdiction*/ return new String[] {"CodeableConcept"};
case -220463842: /*purpose*/ return new String[] {"markdown"};
case 1522889671: /*copyright*/ return new String[] {"markdown"};
case -896505829: /*source*/ return new String[] {"uri", "Reference"};
case -880905839: /*target*/ return new String[] {"uri", "Reference"};
case -896505829: /*source*/ return new String[] {"uri", "canonical"};
case -880905839: /*target*/ return new String[] {"uri", "canonical"};
case 98629247: /*group*/ return new String[] {};
default: return super.getTypesForProperty(hash, name);
}
@ -3536,16 +3540,16 @@ public class ConceptMap extends MetadataResource {
this.source = new UriType();
return this.source;
}
else if (name.equals("sourceReference")) {
this.source = new Reference();
else if (name.equals("sourceCanonical")) {
this.source = new CanonicalType();
return this.source;
}
else if (name.equals("targetUri")) {
this.target = new UriType();
return this.target;
}
else if (name.equals("targetReference")) {
this.target = new Reference();
else if (name.equals("targetCanonical")) {
this.target = new CanonicalType();
return this.target;
}
else if (name.equals("group")) {
@ -3700,21 +3704,27 @@ public class ConceptMap extends MetadataResource {
* Search parameter: <b>other</b>
* <p>
* Description: <b>Canonical URL for other concept map</b><br>
* Type: <b>uri</b><br>
* Type: <b>reference</b><br>
* Path: <b>ConceptMap.group.unmapped.url</b><br>
* </p>
*/
@SearchParamDefinition(name="other", path="ConceptMap.group.unmapped.url", description="Canonical URL for other concept map", type="uri" )
@SearchParamDefinition(name="other", path="ConceptMap.group.unmapped.url", description="Canonical URL for other concept map", type="reference", target={ConceptMap.class } )
public static final String SP_OTHER = "other";
/**
* <b>Fluent Client</b> search parameter constant for <b>other</b>
* <p>
* Description: <b>Canonical URL for other concept map</b><br>
* Type: <b>uri</b><br>
* Type: <b>reference</b><br>
* Path: <b>ConceptMap.group.unmapped.url</b><br>
* </p>
*/
public static final ca.uhn.fhir.rest.gclient.UriClientParam OTHER = new ca.uhn.fhir.rest.gclient.UriClientParam(SP_OTHER);
public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam OTHER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_OTHER);
/**
* Constant for fluent queries to be used to add include statements. Specifies
* the path value of "<b>ConceptMap:other</b>".
*/
public static final ca.uhn.fhir.model.api.Include INCLUDE_OTHER = new ca.uhn.fhir.model.api.Include("ConceptMap:other").toLocked();
/**
* Search parameter: <b>target-system</b>
@ -3801,17 +3811,17 @@ public class ConceptMap extends MetadataResource {
* <p>
* Description: <b>Identifies the source of the concepts which are being mapped</b><br>
* Type: <b>reference</b><br>
* Path: <b>ConceptMap.sourceReference</b><br>
* Path: <b>ConceptMap.sourceCanonical</b><br>
* </p>
*/
@SearchParamDefinition(name="source", path="ConceptMap.source.as(Reference)", description="Identifies the source of the concepts which are being mapped", type="reference", target={ValueSet.class } )
@SearchParamDefinition(name="source", path="ConceptMap.source.as(canonical)", description="Identifies the source of the concepts which are being mapped", type="reference", target={ValueSet.class } )
public static final String SP_SOURCE = "source";
/**
* <b>Fluent Client</b> search parameter constant for <b>source</b>
* <p>
* Description: <b>Identifies the source of the concepts which are being mapped</b><br>
* Type: <b>reference</b><br>
* Path: <b>ConceptMap.sourceReference</b><br>
* Path: <b>ConceptMap.sourceCanonical</b><br>
* </p>
*/
public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SOURCE = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SOURCE);
@ -3887,17 +3897,17 @@ public class ConceptMap extends MetadataResource {
* <p>
* Description: <b>Provides context to the mappings</b><br>
* Type: <b>reference</b><br>
* Path: <b>ConceptMap.targetReference</b><br>
* Path: <b>ConceptMap.targetCanonical</b><br>
* </p>
*/
@SearchParamDefinition(name="target", path="ConceptMap.target.as(Reference)", description="Provides context to the mappings", type="reference", target={ValueSet.class } )
@SearchParamDefinition(name="target", path="ConceptMap.target.as(canonical)", description="Provides context to the mappings", type="reference", target={ValueSet.class } )
public static final String SP_TARGET = "target";
/**
* <b>Fluent Client</b> search parameter constant for <b>target</b>
* <p>
* Description: <b>Provides context to the mappings</b><br>
* Type: <b>reference</b><br>
* Path: <b>ConceptMap.targetReference</b><br>
* Path: <b>ConceptMap.targetCanonical</b><br>
* </p>
*/
public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam TARGET = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_TARGET);

View File

@ -29,7 +29,7 @@ package org.hl7.fhir.r4.model;
*/
// Generated on Tue, Jan 9, 2018 14:51-0500 for FHIR v3.2.0
// Generated on Thu, Mar 1, 2018 20:26+1100 for FHIR v3.2.0
import java.util.*;
@ -1095,10 +1095,10 @@ public class Condition extends DomainResource {
protected List<ConditionStageComponent> stage;
/**
* Supporting Evidence / manifestations that are the basis on which this condition is suspected or confirmed.
* Supporting evidence / manifestations that are the basis of the Condition's verification status, such as evidence that confirmed or refuted the condition.
*/
@Child(name = "evidence", type = {}, order=15, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
@Description(shortDefinition="Supporting evidence", formalDefinition="Supporting Evidence / manifestations that are the basis on which this condition is suspected or confirmed." )
@Description(shortDefinition="Supporting evidence", formalDefinition="Supporting evidence / manifestations that are the basis of the Condition's verification status, such as evidence that confirmed or refuted the condition." )
protected List<ConditionEvidenceComponent> evidence;
/**
@ -1857,7 +1857,7 @@ public class Condition extends DomainResource {
}
/**
* @return {@link #evidence} (Supporting Evidence / manifestations that are the basis on which this condition is suspected or confirmed.)
* @return {@link #evidence} (Supporting evidence / manifestations that are the basis of the Condition's verification status, such as evidence that confirmed or refuted the condition.)
*/
public List<ConditionEvidenceComponent> getEvidence() {
if (this.evidence == null)
@ -1979,7 +1979,7 @@ public class Condition extends DomainResource {
children.add(new Property("recorder", "Reference(Practitioner|Patient|RelatedPerson)", "Individual who recorded the record and takes responsibility for its content.", 0, 1, recorder));
children.add(new Property("asserter", "Reference(Practitioner|PractitionerRole|Patient|RelatedPerson)", "Individual who is making the condition statement.", 0, 1, asserter));
children.add(new Property("stage", "", "Clinical stage or grade of a condition. May include formal severity assessments.", 0, java.lang.Integer.MAX_VALUE, stage));
children.add(new Property("evidence", "", "Supporting Evidence / manifestations that are the basis on which this condition is suspected or confirmed.", 0, java.lang.Integer.MAX_VALUE, evidence));
children.add(new Property("evidence", "", "Supporting evidence / manifestations that are the basis of the Condition's verification status, such as evidence that confirmed or refuted the condition.", 0, java.lang.Integer.MAX_VALUE, evidence));
children.add(new Property("note", "Annotation", "Additional information about the Condition. This is a general notes/comments entry for description of the Condition, its diagnosis and prognosis.", 0, java.lang.Integer.MAX_VALUE, note));
}
@ -2013,7 +2013,7 @@ public class Condition extends DomainResource {
case -799233858: /*recorder*/ return new Property("recorder", "Reference(Practitioner|Patient|RelatedPerson)", "Individual who recorded the record and takes responsibility for its content.", 0, 1, recorder);
case -373242253: /*asserter*/ return new Property("asserter", "Reference(Practitioner|PractitionerRole|Patient|RelatedPerson)", "Individual who is making the condition statement.", 0, 1, asserter);
case 109757182: /*stage*/ return new Property("stage", "", "Clinical stage or grade of a condition. May include formal severity assessments.", 0, java.lang.Integer.MAX_VALUE, stage);
case 382967383: /*evidence*/ return new Property("evidence", "", "Supporting Evidence / manifestations that are the basis on which this condition is suspected or confirmed.", 0, java.lang.Integer.MAX_VALUE, evidence);
case 382967383: /*evidence*/ return new Property("evidence", "", "Supporting evidence / manifestations that are the basis of the Condition's verification status, such as evidence that confirmed or refuted the condition.", 0, java.lang.Integer.MAX_VALUE, evidence);
case 3387378: /*note*/ return new Property("note", "Annotation", "Additional information about the Condition. This is a general notes/comments entry for description of the Condition, its diagnosis and prognosis.", 0, java.lang.Integer.MAX_VALUE, note);
default: return super.getNamedProperty(_hash, _name, _checkValid);
}

View File

@ -29,7 +29,7 @@ package org.hl7.fhir.r4.model;
*/
// Generated on Tue, Jan 9, 2018 14:51-0500 for FHIR v3.2.0
// Generated on Thu, Mar 1, 2018 20:26+1100 for FHIR v3.2.0
import java.util.*;
@ -51,29 +51,37 @@ public class Consent extends DomainResource {
public enum ConsentState {
/**
* The consent is in development or awaiting use but is not yet intended to be acted upon.
* The core event has not started yet, but some staging activities have begun (e.g. surgical suite preparation). Preparation stages may be tracked for billing purposes.
*/
DRAFT,
PREPARATION,
/**
* The consent has been proposed but not yet agreed to by all parties. The negotiation stage.
* The event is currently occurring
*/
PROPOSED,
INPROGRESS,
/**
* The consent is to be followed and enforced.
* The event was terminated prior to any impact on the subject (though preparatory actions may have been taken)
*/
ACTIVE,
NOTDONE,
/**
* The consent has been rejected by one or more of the parties.
* The event has been temporarily stopped but is expected to resume in the future
*/
REJECTED,
SUSPENDED,
/**
* The consent is terminated or replaced.
* The event was terminated prior to the full completion of the intended actions but after having at least some impact on the subject.
*/
INACTIVE,
ABORTED,
/**
* The consent was created wrongly (e.g. wrong patient) and should be ignored
* The event has now concluded
*/
COMPLETED,
/**
* This electronic record should never have existed, though it is possible that real-world decisions were based on it. (If real-world activity has occurred, the status should be "cancelled" rather than "entered-in-error".)
*/
ENTEREDINERROR,
/**
* The authoring system does not know which of the status values currently applies for this request. Note: This concept is not to be used for "other" - one of the listed statuses is presumed to apply, it's just not known which one.
*/
UNKNOWN,
/**
* added to help the parsers with the generic types
*/
@ -81,18 +89,22 @@ public class Consent extends DomainResource {
public static ConsentState fromCode(String codeString) throws FHIRException {
if (codeString == null || "".equals(codeString))
return null;
if ("draft".equals(codeString))
return DRAFT;
if ("proposed".equals(codeString))
return PROPOSED;
if ("active".equals(codeString))
return ACTIVE;
if ("rejected".equals(codeString))
return REJECTED;
if ("inactive".equals(codeString))
return INACTIVE;
if ("preparation".equals(codeString))
return PREPARATION;
if ("in-progress".equals(codeString))
return INPROGRESS;
if ("not-done".equals(codeString))
return NOTDONE;
if ("suspended".equals(codeString))
return SUSPENDED;
if ("aborted".equals(codeString))
return ABORTED;
if ("completed".equals(codeString))
return COMPLETED;
if ("entered-in-error".equals(codeString))
return ENTEREDINERROR;
if ("unknown".equals(codeString))
return UNKNOWN;
if (Configuration.isAcceptInvalidEnums())
return null;
else
@ -100,45 +112,53 @@ public class Consent extends DomainResource {
}
public String toCode() {
switch (this) {
case DRAFT: return "draft";
case PROPOSED: return "proposed";
case ACTIVE: return "active";
case REJECTED: return "rejected";
case INACTIVE: return "inactive";
case PREPARATION: return "preparation";
case INPROGRESS: return "in-progress";
case NOTDONE: return "not-done";
case SUSPENDED: return "suspended";
case ABORTED: return "aborted";
case COMPLETED: return "completed";
case ENTEREDINERROR: return "entered-in-error";
case UNKNOWN: return "unknown";
default: return "?";
}
}
public String getSystem() {
switch (this) {
case DRAFT: return "http://hl7.org/fhir/consent-state-codes";
case PROPOSED: return "http://hl7.org/fhir/consent-state-codes";
case ACTIVE: return "http://hl7.org/fhir/consent-state-codes";
case REJECTED: return "http://hl7.org/fhir/consent-state-codes";
case INACTIVE: return "http://hl7.org/fhir/consent-state-codes";
case ENTEREDINERROR: return "http://hl7.org/fhir/consent-state-codes";
case PREPARATION: return "http://hl7.org/fhir/event-status";
case INPROGRESS: return "http://hl7.org/fhir/event-status";
case NOTDONE: return "http://hl7.org/fhir/event-status";
case SUSPENDED: return "http://hl7.org/fhir/event-status";
case ABORTED: return "http://hl7.org/fhir/event-status";
case COMPLETED: return "http://hl7.org/fhir/event-status";
case ENTEREDINERROR: return "http://hl7.org/fhir/event-status";
case UNKNOWN: return "http://hl7.org/fhir/event-status";
default: return "?";
}
}
public String getDefinition() {
switch (this) {
case DRAFT: return "The consent is in development or awaiting use but is not yet intended to be acted upon.";
case PROPOSED: return "The consent has been proposed but not yet agreed to by all parties. The negotiation stage.";
case ACTIVE: return "The consent is to be followed and enforced.";
case REJECTED: return "The consent has been rejected by one or more of the parties.";
case INACTIVE: return "The consent is terminated or replaced.";
case ENTEREDINERROR: return "The consent was created wrongly (e.g. wrong patient) and should be ignored";
case PREPARATION: return "The core event has not started yet, but some staging activities have begun (e.g. surgical suite preparation). Preparation stages may be tracked for billing purposes.";
case INPROGRESS: return "The event is currently occurring";
case NOTDONE: return "The event was terminated prior to any impact on the subject (though preparatory actions may have been taken)";
case SUSPENDED: return "The event has been temporarily stopped but is expected to resume in the future";
case ABORTED: return "The event was terminated prior to the full completion of the intended actions but after having at least some impact on the subject.";
case COMPLETED: return "The event has now concluded";
case ENTEREDINERROR: return "This electronic record should never have existed, though it is possible that real-world decisions were based on it. (If real-world activity has occurred, the status should be \"cancelled\" rather than \"entered-in-error\".)";
case UNKNOWN: return "The authoring system does not know which of the status values currently applies for this request. Note: This concept is not to be used for \"other\" - one of the listed statuses is presumed to apply, it's just not known which one.";
default: return "?";
}
}
public String getDisplay() {
switch (this) {
case DRAFT: return "Pending";
case PROPOSED: return "Proposed";
case ACTIVE: return "Active";
case REJECTED: return "Rejected";
case INACTIVE: return "Inactive";
case PREPARATION: return "Preparation";
case INPROGRESS: return "In Progress";
case NOTDONE: return "Not Done";
case SUSPENDED: return "Suspended";
case ABORTED: return "Aborted";
case COMPLETED: return "Completed";
case ENTEREDINERROR: return "Entered in Error";
case UNKNOWN: return "Unknown";
default: return "?";
}
}
@ -149,18 +169,22 @@ public class Consent extends DomainResource {
if (codeString == null || "".equals(codeString))
if (codeString == null || "".equals(codeString))
return null;
if ("draft".equals(codeString))
return ConsentState.DRAFT;
if ("proposed".equals(codeString))
return ConsentState.PROPOSED;
if ("active".equals(codeString))
return ConsentState.ACTIVE;
if ("rejected".equals(codeString))
return ConsentState.REJECTED;
if ("inactive".equals(codeString))
return ConsentState.INACTIVE;
if ("preparation".equals(codeString))
return ConsentState.PREPARATION;
if ("in-progress".equals(codeString))
return ConsentState.INPROGRESS;
if ("not-done".equals(codeString))
return ConsentState.NOTDONE;
if ("suspended".equals(codeString))
return ConsentState.SUSPENDED;
if ("aborted".equals(codeString))
return ConsentState.ABORTED;
if ("completed".equals(codeString))
return ConsentState.COMPLETED;
if ("entered-in-error".equals(codeString))
return ConsentState.ENTEREDINERROR;
if ("unknown".equals(codeString))
return ConsentState.UNKNOWN;
throw new IllegalArgumentException("Unknown ConsentState code '"+codeString+"'");
}
public Enumeration<ConsentState> fromType(Base code) throws FHIRException {
@ -171,33 +195,41 @@ public class Consent extends DomainResource {
String codeString = ((PrimitiveType) code).asStringValue();
if (codeString == null || "".equals(codeString))
return null;
if ("draft".equals(codeString))
return new Enumeration<ConsentState>(this, ConsentState.DRAFT);
if ("proposed".equals(codeString))
return new Enumeration<ConsentState>(this, ConsentState.PROPOSED);
if ("active".equals(codeString))
return new Enumeration<ConsentState>(this, ConsentState.ACTIVE);
if ("rejected".equals(codeString))
return new Enumeration<ConsentState>(this, ConsentState.REJECTED);
if ("inactive".equals(codeString))
return new Enumeration<ConsentState>(this, ConsentState.INACTIVE);
if ("preparation".equals(codeString))
return new Enumeration<ConsentState>(this, ConsentState.PREPARATION);
if ("in-progress".equals(codeString))
return new Enumeration<ConsentState>(this, ConsentState.INPROGRESS);
if ("not-done".equals(codeString))
return new Enumeration<ConsentState>(this, ConsentState.NOTDONE);
if ("suspended".equals(codeString))
return new Enumeration<ConsentState>(this, ConsentState.SUSPENDED);
if ("aborted".equals(codeString))
return new Enumeration<ConsentState>(this, ConsentState.ABORTED);
if ("completed".equals(codeString))
return new Enumeration<ConsentState>(this, ConsentState.COMPLETED);
if ("entered-in-error".equals(codeString))
return new Enumeration<ConsentState>(this, ConsentState.ENTEREDINERROR);
if ("unknown".equals(codeString))
return new Enumeration<ConsentState>(this, ConsentState.UNKNOWN);
throw new FHIRException("Unknown ConsentState code '"+codeString+"'");
}
public String toCode(ConsentState code) {
if (code == ConsentState.DRAFT)
return "draft";
if (code == ConsentState.PROPOSED)
return "proposed";
if (code == ConsentState.ACTIVE)
return "active";
if (code == ConsentState.REJECTED)
return "rejected";
if (code == ConsentState.INACTIVE)
return "inactive";
if (code == ConsentState.PREPARATION)
return "preparation";
if (code == ConsentState.INPROGRESS)
return "in-progress";
if (code == ConsentState.NOTDONE)
return "not-done";
if (code == ConsentState.SUSPENDED)
return "suspended";
if (code == ConsentState.ABORTED)
return "aborted";
if (code == ConsentState.COMPLETED)
return "completed";
if (code == ConsentState.ENTEREDINERROR)
return "entered-in-error";
if (code == ConsentState.UNKNOWN)
return "unknown";
return "?";
}
public String toSystem(ConsentState code) {
@ -205,130 +237,6 @@ public class Consent extends DomainResource {
}
}
public enum ConsentScope {
/**
* Actions to be taken if they are no longer able to make decisions for themselves
*/
ADR,
/**
* Consent to participate in research protocol and information sharing required
*/
RESEARCH,
/**
* Agreement to collect, access, use or disclose (share) information
*/
PRIVACY,
/**
* Consent to undergo a specific treatment
*/
TREATMENT,
/**
* added to help the parsers with the generic types
*/
NULL;
public static ConsentScope fromCode(String codeString) throws FHIRException {
if (codeString == null || "".equals(codeString))
return null;
if ("ADR".equals(codeString))
return ADR;
if ("research".equals(codeString))
return RESEARCH;
if ("privacy".equals(codeString))
return PRIVACY;
if ("treatment".equals(codeString))
return TREATMENT;
if (Configuration.isAcceptInvalidEnums())
return null;
else
throw new FHIRException("Unknown ConsentScope code '"+codeString+"'");
}
public String toCode() {
switch (this) {
case ADR: return "ADR";
case RESEARCH: return "research";
case PRIVACY: return "privacy";
case TREATMENT: return "treatment";
default: return "?";
}
}
public String getSystem() {
switch (this) {
case ADR: return "http://hl7.org/fhir/consentscope";
case RESEARCH: return "http://hl7.org/fhir/consentscope";
case PRIVACY: return "http://hl7.org/fhir/consentscope";
case TREATMENT: return "http://hl7.org/fhir/consentscope";
default: return "?";
}
}
public String getDefinition() {
switch (this) {
case ADR: return "Actions to be taken if they are no longer able to make decisions for themselves";
case RESEARCH: return "Consent to participate in research protocol and information sharing required";
case PRIVACY: return "Agreement to collect, access, use or disclose (share) information";
case TREATMENT: return "Consent to undergo a specific treatment";
default: return "?";
}
}
public String getDisplay() {
switch (this) {
case ADR: return "Advanced Care Directive";
case RESEARCH: return "Research";
case PRIVACY: return "Privacy Consent";
case TREATMENT: return "Treatment";
default: return "?";
}
}
}
public static class ConsentScopeEnumFactory implements EnumFactory<ConsentScope> {
public ConsentScope fromCode(String codeString) throws IllegalArgumentException {
if (codeString == null || "".equals(codeString))
if (codeString == null || "".equals(codeString))
return null;
if ("ADR".equals(codeString))
return ConsentScope.ADR;
if ("research".equals(codeString))
return ConsentScope.RESEARCH;
if ("privacy".equals(codeString))
return ConsentScope.PRIVACY;
if ("treatment".equals(codeString))
return ConsentScope.TREATMENT;
throw new IllegalArgumentException("Unknown ConsentScope code '"+codeString+"'");
}
public Enumeration<ConsentScope> fromType(Base code) throws FHIRException {
if (code == null)
return null;
if (code.isEmpty())
return new Enumeration<ConsentScope>(this);
String codeString = ((PrimitiveType) code).asStringValue();
if (codeString == null || "".equals(codeString))
return null;
if ("ADR".equals(codeString))
return new Enumeration<ConsentScope>(this, ConsentScope.ADR);
if ("research".equals(codeString))
return new Enumeration<ConsentScope>(this, ConsentScope.RESEARCH);
if ("privacy".equals(codeString))
return new Enumeration<ConsentScope>(this, ConsentScope.PRIVACY);
if ("treatment".equals(codeString))
return new Enumeration<ConsentScope>(this, ConsentScope.TREATMENT);
throw new FHIRException("Unknown ConsentScope code '"+codeString+"'");
}
public String toCode(ConsentScope code) {
if (code == ConsentScope.ADR)
return "ADR";
if (code == ConsentScope.RESEARCH)
return "research";
if (code == ConsentScope.PRIVACY)
return "privacy";
if (code == ConsentScope.TREATMENT)
return "treatment";
return "?";
}
public String toSystem(ConsentScope code) {
return code.getSystem();
}
}
public enum ConsentProvisionType {
/**
* Consent is denied for actions meeting these rules
@ -2024,7 +1932,7 @@ public class Consent extends DomainResource {
/**
* The resource that identifies the actor. To identify a actors by type, use group to identify a set of actors by some property they share (e.g. 'admitting officers').
*/
@Child(name = "reference", type = {Device.class, Group.class, CareTeam.class, Organization.class, Patient.class, Practitioner.class, RelatedPerson.class}, order=2, min=1, max=1, modifier=false, summary=false)
@Child(name = "reference", type = {Device.class, Group.class, CareTeam.class, Organization.class, Patient.class, Practitioner.class, RelatedPerson.class, PractitionerRole.class}, order=2, min=1, max=1, modifier=false, summary=false)
@Description(shortDefinition="Resource for the actor (or group, by role)", formalDefinition="The resource that identifies the actor. To identify a actors by type, use group to identify a set of actors by some property they share (e.g. 'admitting officers')." )
protected Reference reference;
@ -2117,14 +2025,14 @@ public class Consent extends DomainResource {
protected void listChildren(List<Property> children) {
super.listChildren(children);
children.add(new Property("role", "CodeableConcept", "How the individual is involved in the resources content that is described in the exception.", 0, 1, role));
children.add(new Property("reference", "Reference(Device|Group|CareTeam|Organization|Patient|Practitioner|RelatedPerson)", "The resource that identifies the actor. To identify a actors by type, use group to identify a set of actors by some property they share (e.g. 'admitting officers').", 0, 1, reference));
children.add(new Property("reference", "Reference(Device|Group|CareTeam|Organization|Patient|Practitioner|RelatedPerson|PractitionerRole)", "The resource that identifies the actor. To identify a actors by type, use group to identify a set of actors by some property they share (e.g. 'admitting officers').", 0, 1, reference));
}
@Override
public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
switch (_hash) {
case 3506294: /*role*/ return new Property("role", "CodeableConcept", "How the individual is involved in the resources content that is described in the exception.", 0, 1, role);
case -925155509: /*reference*/ return new Property("reference", "Reference(Device|Group|CareTeam|Organization|Patient|Practitioner|RelatedPerson)", "The resource that identifies the actor. To identify a actors by type, use group to identify a set of actors by some property they share (e.g. 'admitting officers').", 0, 1, reference);
case -925155509: /*reference*/ return new Property("reference", "Reference(Device|Group|CareTeam|Organization|Patient|Practitioner|RelatedPerson|PractitionerRole)", "The resource that identifies the actor. To identify a actors by type, use group to identify a set of actors by some property they share (e.g. 'admitting officers').", 0, 1, reference);
default: return super.getNamedProperty(_hash, _name, _checkValid);
}
@ -2490,25 +2398,25 @@ public class Consent extends DomainResource {
/**
* Unique identifier for this copy of the Consent Statement.
*/
@Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=1, modifier=false, summary=true)
@Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
@Description(shortDefinition="Identifier for this record (external references)", formalDefinition="Unique identifier for this copy of the Consent Statement." )
protected Identifier identifier;
protected List<Identifier> identifier;
/**
* Indicates the current state of this consent.
*/
@Child(name = "status", type = {CodeType.class}, order=1, min=1, max=1, modifier=true, summary=true)
@Description(shortDefinition="draft | proposed | active | rejected | inactive | entered-in-error", formalDefinition="Indicates the current state of this consent." )
@ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/consent-state-codes")
@ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/event-status")
protected Enumeration<ConsentState> status;
/**
* A selector of the type of consent being presented among the four possible: ADR, Privacy, Treatment, Research.
*/
@Child(name = "scope", type = {CodeType.class}, order=2, min=1, max=1, modifier=true, summary=true)
@Child(name = "scope", type = {CodeableConcept.class}, order=2, min=1, max=1, modifier=true, summary=true)
@Description(shortDefinition="Which of the four areas this resource covers", formalDefinition="A selector of the type of consent being presented among the four possible: ADR, Privacy, Treatment, Research." )
@ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/consent-scope")
protected Enumeration<ConsentScope> scope;
protected CodeableConcept scope;
/**
* A classification of the type of consents found in the statement. This element supports indexing and retrieval of consent statements.
@ -2521,7 +2429,7 @@ public class Consent extends DomainResource {
/**
* The patient/healthcare consumer to whom this consent applies.
*/
@Child(name = "patient", type = {Patient.class}, order=4, min=1, max=1, modifier=false, summary=true)
@Child(name = "patient", type = {Patient.class}, order=4, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="Who the consent applies to", formalDefinition="The patient/healthcare consumer to whom this consent applies." )
protected Reference patient;
@ -2540,13 +2448,13 @@ public class Consent extends DomainResource {
/**
* Either the Grantor, which is the entity responsible for granting the rights listed in a Consent Directive or the Grantee, which is the entity responsible for complying with the Consent Directive, including any obligations or limitations on authorizations and enforcement of prohibitions.
*/
@Child(name = "consentingParty", type = {Organization.class, Patient.class, Practitioner.class, RelatedPerson.class}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
@Child(name = "performer", type = {Organization.class, Patient.class, Practitioner.class, RelatedPerson.class, PractitionerRole.class}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
@Description(shortDefinition="Who is agreeing to the policy and rules", formalDefinition="Either the Grantor, which is the entity responsible for granting the rights listed in a Consent Directive or the Grantee, which is the entity responsible for complying with the Consent Directive, including any obligations or limitations on authorizations and enforcement of prohibitions." )
protected List<Reference> consentingParty;
protected List<Reference> performer;
/**
* The actual objects that are the target of the reference (Either the Grantor, which is the entity responsible for granting the rights listed in a Consent Directive or the Grantee, which is the entity responsible for complying with the Consent Directive, including any obligations or limitations on authorizations and enforcement of prohibitions.)
*/
protected List<Resource> consentingPartyTarget;
protected List<Resource> performerTarget;
/**
@ -2576,11 +2484,11 @@ public class Consent extends DomainResource {
protected List<ConsentPolicyComponent> policy;
/**
* A reference to the specific base computable policy.
* A reference to the specific base computable regulation or policy.
*/
@Child(name = "policyRule", type = {CodeableConcept.class}, order=10, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="Policy that this consents to", formalDefinition="A reference to the specific base computable policy." )
@ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/v3-ActConsentDirective")
@Description(shortDefinition="Regulation that this consents to", formalDefinition="A reference to the specific base computable regulation or policy." )
@ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/consent-policy")
protected CodeableConcept policyRule;
/**
@ -2593,11 +2501,11 @@ public class Consent extends DomainResource {
/**
* An exception to the base policy of this consent. An exception can be an addition or removal of access permissions.
*/
@Child(name = "provision", type = {}, order=12, min=1, max=1, modifier=false, summary=true)
@Child(name = "provision", type = {}, order=12, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="Constraints to the base Consent.policyRule", formalDefinition="An exception to the base policy of this consent. An exception can be an addition or removal of access permissions." )
protected provisionComponent provision;
private static final long serialVersionUID = 1454563219L;
private static final long serialVersionUID = 206528051L;
/**
* Constructor
@ -2609,36 +2517,63 @@ public class Consent extends DomainResource {
/**
* Constructor
*/
public Consent(Enumeration<ConsentState> status, Enumeration<ConsentScope> scope, Reference patient, provisionComponent provision) {
public Consent(Enumeration<ConsentState> status, CodeableConcept scope) {
super();
this.status = status;
this.scope = scope;
this.patient = patient;
this.provision = provision;
}
/**
* @return {@link #identifier} (Unique identifier for this copy of the Consent Statement.)
*/
public Identifier getIdentifier() {
public List<Identifier> getIdentifier() {
if (this.identifier == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create Consent.identifier");
else if (Configuration.doAutoCreate())
this.identifier = new Identifier(); // cc
this.identifier = new ArrayList<Identifier>();
return this.identifier;
}
/**
* @return Returns a reference to <code>this</code> for easy method chaining
*/
public Consent setIdentifier(List<Identifier> theIdentifier) {
this.identifier = theIdentifier;
return this;
}
public boolean hasIdentifier() {
return this.identifier != null && !this.identifier.isEmpty();
if (this.identifier == null)
return false;
for (Identifier item : this.identifier)
if (!item.isEmpty())
return true;
return false;
}
public Identifier addIdentifier() { //3
Identifier t = new Identifier();
if (this.identifier == null)
this.identifier = new ArrayList<Identifier>();
this.identifier.add(t);
return t;
}
public Consent addIdentifier(Identifier t) { //3
if (t == null)
return this;
if (this.identifier == null)
this.identifier = new ArrayList<Identifier>();
this.identifier.add(t);
return this;
}
/**
* @param value {@link #identifier} (Unique identifier for this copy of the Consent Statement.)
* @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist
*/
public Consent setIdentifier(Identifier value) {
this.identifier = value;
return this;
public Identifier getIdentifierFirstRep() {
if (getIdentifier().isEmpty()) {
addIdentifier();
}
return getIdentifier().get(0);
}
/**
@ -2687,50 +2622,29 @@ public class Consent extends DomainResource {
}
/**
* @return {@link #scope} (A selector of the type of consent being presented among the four possible: ADR, Privacy, Treatment, Research.). This is the underlying object with id, value and extensions. The accessor "getScope" gives direct access to the value
* @return {@link #scope} (A selector of the type of consent being presented among the four possible: ADR, Privacy, Treatment, Research.)
*/
public Enumeration<ConsentScope> getScopeElement() {
public CodeableConcept getScope() {
if (this.scope == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create Consent.scope");
else if (Configuration.doAutoCreate())
this.scope = new Enumeration<ConsentScope>(new ConsentScopeEnumFactory()); // bb
this.scope = new CodeableConcept(); // cc
return this.scope;
}
public boolean hasScopeElement() {
return this.scope != null && !this.scope.isEmpty();
}
public boolean hasScope() {
return this.scope != null && !this.scope.isEmpty();
}
/**
* @param value {@link #scope} (A selector of the type of consent being presented among the four possible: ADR, Privacy, Treatment, Research.). This is the underlying object with id, value and extensions. The accessor "getScope" gives direct access to the value
* @param value {@link #scope} (A selector of the type of consent being presented among the four possible: ADR, Privacy, Treatment, Research.)
*/
public Consent setScopeElement(Enumeration<ConsentScope> value) {
public Consent setScope(CodeableConcept value) {
this.scope = value;
return this;
}
/**
* @return A selector of the type of consent being presented among the four possible: ADR, Privacy, Treatment, Research.
*/
public ConsentScope getScope() {
return this.scope == null ? null : this.scope.getValue();
}
/**
* @param value A selector of the type of consent being presented among the four possible: ADR, Privacy, Treatment, Research.
*/
public Consent setScope(ConsentScope value) {
if (this.scope == null)
this.scope = new Enumeration<ConsentScope>(new ConsentScopeEnumFactory());
this.scope.setValue(value);
return this;
}
/**
* @return {@link #category} (A classification of the type of consents found in the statement. This element supports indexing and retrieval of consent statements.)
*/
@ -2878,66 +2792,66 @@ public class Consent extends DomainResource {
}
/**
* @return {@link #consentingParty} (Either the Grantor, which is the entity responsible for granting the rights listed in a Consent Directive or the Grantee, which is the entity responsible for complying with the Consent Directive, including any obligations or limitations on authorizations and enforcement of prohibitions.)
* @return {@link #performer} (Either the Grantor, which is the entity responsible for granting the rights listed in a Consent Directive or the Grantee, which is the entity responsible for complying with the Consent Directive, including any obligations or limitations on authorizations and enforcement of prohibitions.)
*/
public List<Reference> getConsentingParty() {
if (this.consentingParty == null)
this.consentingParty = new ArrayList<Reference>();
return this.consentingParty;
public List<Reference> getPerformer() {
if (this.performer == null)
this.performer = new ArrayList<Reference>();
return this.performer;
}
/**
* @return Returns a reference to <code>this</code> for easy method chaining
*/
public Consent setConsentingParty(List<Reference> theConsentingParty) {
this.consentingParty = theConsentingParty;
public Consent setPerformer(List<Reference> thePerformer) {
this.performer = thePerformer;
return this;
}
public boolean hasConsentingParty() {
if (this.consentingParty == null)
public boolean hasPerformer() {
if (this.performer == null)
return false;
for (Reference item : this.consentingParty)
for (Reference item : this.performer)
if (!item.isEmpty())
return true;
return false;
}
public Reference addConsentingParty() { //3
public Reference addPerformer() { //3
Reference t = new Reference();
if (this.consentingParty == null)
this.consentingParty = new ArrayList<Reference>();
this.consentingParty.add(t);
if (this.performer == null)
this.performer = new ArrayList<Reference>();
this.performer.add(t);
return t;
}
public Consent addConsentingParty(Reference t) { //3
public Consent addPerformer(Reference t) { //3
if (t == null)
return this;
if (this.consentingParty == null)
this.consentingParty = new ArrayList<Reference>();
this.consentingParty.add(t);
if (this.performer == null)
this.performer = new ArrayList<Reference>();
this.performer.add(t);
return this;
}
/**
* @return The first repetition of repeating field {@link #consentingParty}, creating it if it does not already exist
* @return The first repetition of repeating field {@link #performer}, creating it if it does not already exist
*/
public Reference getConsentingPartyFirstRep() {
if (getConsentingParty().isEmpty()) {
addConsentingParty();
public Reference getPerformerFirstRep() {
if (getPerformer().isEmpty()) {
addPerformer();
}
return getConsentingParty().get(0);
return getPerformer().get(0);
}
/**
* @deprecated Use Reference#setResource(IBaseResource) instead
*/
@Deprecated
public List<Resource> getConsentingPartyTarget() {
if (this.consentingPartyTarget == null)
this.consentingPartyTarget = new ArrayList<Resource>();
return this.consentingPartyTarget;
public List<Resource> getPerformerTarget() {
if (this.performerTarget == null)
this.performerTarget = new ArrayList<Resource>();
return this.performerTarget;
}
/**
@ -3127,7 +3041,7 @@ public class Consent extends DomainResource {
}
/**
* @return {@link #policyRule} (A reference to the specific base computable policy.)
* @return {@link #policyRule} (A reference to the specific base computable regulation or policy.)
*/
public CodeableConcept getPolicyRule() {
if (this.policyRule == null)
@ -3143,7 +3057,7 @@ public class Consent extends DomainResource {
}
/**
* @param value {@link #policyRule} (A reference to the specific base computable policy.)
* @param value {@link #policyRule} (A reference to the specific base computable regulation or policy.)
*/
public Consent setPolicyRule(CodeableConcept value) {
this.policyRule = value;
@ -3229,17 +3143,17 @@ public class Consent extends DomainResource {
protected void listChildren(List<Property> children) {
super.listChildren(children);
children.add(new Property("identifier", "Identifier", "Unique identifier for this copy of the Consent Statement.", 0, 1, identifier));
children.add(new Property("identifier", "Identifier", "Unique identifier for this copy of the Consent Statement.", 0, java.lang.Integer.MAX_VALUE, identifier));
children.add(new Property("status", "code", "Indicates the current state of this consent.", 0, 1, status));
children.add(new Property("scope", "code", "A selector of the type of consent being presented among the four possible: ADR, Privacy, Treatment, Research.", 0, 1, scope));
children.add(new Property("scope", "CodeableConcept", "A selector of the type of consent being presented among the four possible: ADR, Privacy, Treatment, Research.", 0, 1, scope));
children.add(new Property("category", "CodeableConcept", "A classification of the type of consents found in the statement. This element supports indexing and retrieval of consent statements.", 0, java.lang.Integer.MAX_VALUE, category));
children.add(new Property("patient", "Reference(Patient)", "The patient/healthcare consumer to whom this consent applies.", 0, 1, patient));
children.add(new Property("dateTime", "dateTime", "When this Consent was issued / created / indexed.", 0, 1, dateTime));
children.add(new Property("consentingParty", "Reference(Organization|Patient|Practitioner|RelatedPerson)", "Either the Grantor, which is the entity responsible for granting the rights listed in a Consent Directive or the Grantee, which is the entity responsible for complying with the Consent Directive, including any obligations or limitations on authorizations and enforcement of prohibitions.", 0, java.lang.Integer.MAX_VALUE, consentingParty));
children.add(new Property("performer", "Reference(Organization|Patient|Practitioner|RelatedPerson|PractitionerRole)", "Either the Grantor, which is the entity responsible for granting the rights listed in a Consent Directive or the Grantee, which is the entity responsible for complying with the Consent Directive, including any obligations or limitations on authorizations and enforcement of prohibitions.", 0, java.lang.Integer.MAX_VALUE, performer));
children.add(new Property("organization", "Reference(Organization)", "The organization that manages the consent, and the framework within which it is executed.", 0, java.lang.Integer.MAX_VALUE, organization));
children.add(new Property("source[x]", "Attachment|Identifier|Reference(Consent|DocumentReference|Contract|QuestionnaireResponse)", "The source on which this consent statement is based. The source might be a scanned original paper form, or a reference to a consent that links back to such a source, a reference to a document repository (e.g. XDS) that stores the original consent document.", 0, 1, source));
children.add(new Property("policy", "", "The references to the policies that are included in this consent scope. Policies may be organizational, but are often defined jurisdictionally, or in law.", 0, java.lang.Integer.MAX_VALUE, policy));
children.add(new Property("policyRule", "CodeableConcept", "A reference to the specific base computable policy.", 0, 1, policyRule));
children.add(new Property("policyRule", "CodeableConcept", "A reference to the specific base computable regulation or policy.", 0, 1, policyRule));
children.add(new Property("verification", "", "Whether a treatment instruction (e.g. artifical respiration yes or no) was verified with the patient, his/her family or another authorized person.", 0, java.lang.Integer.MAX_VALUE, verification));
children.add(new Property("provision", "", "An exception to the base policy of this consent. An exception can be an addition or removal of access permissions.", 0, 1, provision));
}
@ -3247,13 +3161,13 @@ public class Consent extends DomainResource {
@Override
public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
switch (_hash) {
case -1618432855: /*identifier*/ return new Property("identifier", "Identifier", "Unique identifier for this copy of the Consent Statement.", 0, 1, identifier);
case -1618432855: /*identifier*/ return new Property("identifier", "Identifier", "Unique identifier for this copy of the Consent Statement.", 0, java.lang.Integer.MAX_VALUE, identifier);
case -892481550: /*status*/ return new Property("status", "code", "Indicates the current state of this consent.", 0, 1, status);
case 109264468: /*scope*/ return new Property("scope", "code", "A selector of the type of consent being presented among the four possible: ADR, Privacy, Treatment, Research.", 0, 1, scope);
case 109264468: /*scope*/ return new Property("scope", "CodeableConcept", "A selector of the type of consent being presented among the four possible: ADR, Privacy, Treatment, Research.", 0, 1, scope);
case 50511102: /*category*/ return new Property("category", "CodeableConcept", "A classification of the type of consents found in the statement. This element supports indexing and retrieval of consent statements.", 0, java.lang.Integer.MAX_VALUE, category);
case -791418107: /*patient*/ return new Property("patient", "Reference(Patient)", "The patient/healthcare consumer to whom this consent applies.", 0, 1, patient);
case 1792749467: /*dateTime*/ return new Property("dateTime", "dateTime", "When this Consent was issued / created / indexed.", 0, 1, dateTime);
case -1886702018: /*consentingParty*/ return new Property("consentingParty", "Reference(Organization|Patient|Practitioner|RelatedPerson)", "Either the Grantor, which is the entity responsible for granting the rights listed in a Consent Directive or the Grantee, which is the entity responsible for complying with the Consent Directive, including any obligations or limitations on authorizations and enforcement of prohibitions.", 0, java.lang.Integer.MAX_VALUE, consentingParty);
case 481140686: /*performer*/ return new Property("performer", "Reference(Organization|Patient|Practitioner|RelatedPerson|PractitionerRole)", "Either the Grantor, which is the entity responsible for granting the rights listed in a Consent Directive or the Grantee, which is the entity responsible for complying with the Consent Directive, including any obligations or limitations on authorizations and enforcement of prohibitions.", 0, java.lang.Integer.MAX_VALUE, performer);
case 1178922291: /*organization*/ return new Property("organization", "Reference(Organization)", "The organization that manages the consent, and the framework within which it is executed.", 0, java.lang.Integer.MAX_VALUE, organization);
case -1698413947: /*source[x]*/ return new Property("source[x]", "Attachment|Identifier|Reference(Consent|DocumentReference|Contract|QuestionnaireResponse)", "The source on which this consent statement is based. The source might be a scanned original paper form, or a reference to a consent that links back to such a source, a reference to a document repository (e.g. XDS) that stores the original consent document.", 0, 1, source);
case -896505829: /*source*/ return new Property("source[x]", "Attachment|Identifier|Reference(Consent|DocumentReference|Contract|QuestionnaireResponse)", "The source on which this consent statement is based. The source might be a scanned original paper form, or a reference to a consent that links back to such a source, a reference to a document repository (e.g. XDS) that stores the original consent document.", 0, 1, source);
@ -3261,7 +3175,7 @@ public class Consent extends DomainResource {
case -1985492188: /*sourceIdentifier*/ return new Property("source[x]", "Attachment|Identifier|Reference(Consent|DocumentReference|Contract|QuestionnaireResponse)", "The source on which this consent statement is based. The source might be a scanned original paper form, or a reference to a consent that links back to such a source, a reference to a document repository (e.g. XDS) that stores the original consent document.", 0, 1, source);
case -244259472: /*sourceReference*/ return new Property("source[x]", "Attachment|Identifier|Reference(Consent|DocumentReference|Contract|QuestionnaireResponse)", "The source on which this consent statement is based. The source might be a scanned original paper form, or a reference to a consent that links back to such a source, a reference to a document repository (e.g. XDS) that stores the original consent document.", 0, 1, source);
case -982670030: /*policy*/ return new Property("policy", "", "The references to the policies that are included in this consent scope. Policies may be organizational, but are often defined jurisdictionally, or in law.", 0, java.lang.Integer.MAX_VALUE, policy);
case 1593493326: /*policyRule*/ return new Property("policyRule", "CodeableConcept", "A reference to the specific base computable policy.", 0, 1, policyRule);
case 1593493326: /*policyRule*/ return new Property("policyRule", "CodeableConcept", "A reference to the specific base computable regulation or policy.", 0, 1, policyRule);
case -1484401125: /*verification*/ return new Property("verification", "", "Whether a treatment instruction (e.g. artifical respiration yes or no) was verified with the patient, his/her family or another authorized person.", 0, java.lang.Integer.MAX_VALUE, verification);
case -547120939: /*provision*/ return new Property("provision", "", "An exception to the base policy of this consent. An exception can be an addition or removal of access permissions.", 0, 1, provision);
default: return super.getNamedProperty(_hash, _name, _checkValid);
@ -3272,13 +3186,13 @@ public class Consent extends DomainResource {
@Override
public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
switch (hash) {
case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : new Base[] {this.identifier}; // Identifier
case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<ConsentState>
case 109264468: /*scope*/ return this.scope == null ? new Base[0] : new Base[] {this.scope}; // Enumeration<ConsentScope>
case 109264468: /*scope*/ return this.scope == null ? new Base[0] : new Base[] {this.scope}; // CodeableConcept
case 50511102: /*category*/ return this.category == null ? new Base[0] : this.category.toArray(new Base[this.category.size()]); // CodeableConcept
case -791418107: /*patient*/ return this.patient == null ? new Base[0] : new Base[] {this.patient}; // Reference
case 1792749467: /*dateTime*/ return this.dateTime == null ? new Base[0] : new Base[] {this.dateTime}; // DateTimeType
case -1886702018: /*consentingParty*/ return this.consentingParty == null ? new Base[0] : this.consentingParty.toArray(new Base[this.consentingParty.size()]); // Reference
case 481140686: /*performer*/ return this.performer == null ? new Base[0] : this.performer.toArray(new Base[this.performer.size()]); // Reference
case 1178922291: /*organization*/ return this.organization == null ? new Base[0] : this.organization.toArray(new Base[this.organization.size()]); // Reference
case -896505829: /*source*/ return this.source == null ? new Base[0] : new Base[] {this.source}; // Type
case -982670030: /*policy*/ return this.policy == null ? new Base[0] : this.policy.toArray(new Base[this.policy.size()]); // ConsentPolicyComponent
@ -3294,15 +3208,14 @@ public class Consent extends DomainResource {
public Base setProperty(int hash, String name, Base value) throws FHIRException {
switch (hash) {
case -1618432855: // identifier
this.identifier = castToIdentifier(value); // Identifier
this.getIdentifier().add(castToIdentifier(value)); // Identifier
return value;
case -892481550: // status
value = new ConsentStateEnumFactory().fromType(castToCode(value));
this.status = (Enumeration) value; // Enumeration<ConsentState>
return value;
case 109264468: // scope
value = new ConsentScopeEnumFactory().fromType(castToCode(value));
this.scope = (Enumeration) value; // Enumeration<ConsentScope>
this.scope = castToCodeableConcept(value); // CodeableConcept
return value;
case 50511102: // category
this.getCategory().add(castToCodeableConcept(value)); // CodeableConcept
@ -3313,8 +3226,8 @@ public class Consent extends DomainResource {
case 1792749467: // dateTime
this.dateTime = castToDateTime(value); // DateTimeType
return value;
case -1886702018: // consentingParty
this.getConsentingParty().add(castToReference(value)); // Reference
case 481140686: // performer
this.getPerformer().add(castToReference(value)); // Reference
return value;
case 1178922291: // organization
this.getOrganization().add(castToReference(value)); // Reference
@ -3342,21 +3255,20 @@ public class Consent extends DomainResource {
@Override
public Base setProperty(String name, Base value) throws FHIRException {
if (name.equals("identifier")) {
this.identifier = castToIdentifier(value); // Identifier
this.getIdentifier().add(castToIdentifier(value));
} else if (name.equals("status")) {
value = new ConsentStateEnumFactory().fromType(castToCode(value));
this.status = (Enumeration) value; // Enumeration<ConsentState>
} else if (name.equals("scope")) {
value = new ConsentScopeEnumFactory().fromType(castToCode(value));
this.scope = (Enumeration) value; // Enumeration<ConsentScope>
this.scope = castToCodeableConcept(value); // CodeableConcept
} else if (name.equals("category")) {
this.getCategory().add(castToCodeableConcept(value));
} else if (name.equals("patient")) {
this.patient = castToReference(value); // Reference
} else if (name.equals("dateTime")) {
this.dateTime = castToDateTime(value); // DateTimeType
} else if (name.equals("consentingParty")) {
this.getConsentingParty().add(castToReference(value));
} else if (name.equals("performer")) {
this.getPerformer().add(castToReference(value));
} else if (name.equals("organization")) {
this.getOrganization().add(castToReference(value));
} else if (name.equals("source[x]")) {
@ -3377,13 +3289,13 @@ public class Consent extends DomainResource {
@Override
public Base makeProperty(int hash, String name) throws FHIRException {
switch (hash) {
case -1618432855: return getIdentifier();
case -1618432855: return addIdentifier();
case -892481550: return getStatusElement();
case 109264468: return getScopeElement();
case 109264468: return getScope();
case 50511102: return addCategory();
case -791418107: return getPatient();
case 1792749467: return getDateTimeElement();
case -1886702018: return addConsentingParty();
case 481140686: return addPerformer();
case 1178922291: return addOrganization();
case -1698413947: return getSource();
case -896505829: return getSource();
@ -3401,11 +3313,11 @@ public class Consent extends DomainResource {
switch (hash) {
case -1618432855: /*identifier*/ return new String[] {"Identifier"};
case -892481550: /*status*/ return new String[] {"code"};
case 109264468: /*scope*/ return new String[] {"code"};
case 109264468: /*scope*/ return new String[] {"CodeableConcept"};
case 50511102: /*category*/ return new String[] {"CodeableConcept"};
case -791418107: /*patient*/ return new String[] {"Reference"};
case 1792749467: /*dateTime*/ return new String[] {"dateTime"};
case -1886702018: /*consentingParty*/ return new String[] {"Reference"};
case 481140686: /*performer*/ return new String[] {"Reference"};
case 1178922291: /*organization*/ return new String[] {"Reference"};
case -896505829: /*source*/ return new String[] {"Attachment", "Identifier", "Reference"};
case -982670030: /*policy*/ return new String[] {};
@ -3420,14 +3332,14 @@ public class Consent extends DomainResource {
@Override
public Base addChild(String name) throws FHIRException {
if (name.equals("identifier")) {
this.identifier = new Identifier();
return this.identifier;
return addIdentifier();
}
else if (name.equals("status")) {
throw new FHIRException("Cannot call addChild on a primitive type Consent.status");
}
else if (name.equals("scope")) {
throw new FHIRException("Cannot call addChild on a primitive type Consent.scope");
this.scope = new CodeableConcept();
return this.scope;
}
else if (name.equals("category")) {
return addCategory();
@ -3439,8 +3351,8 @@ public class Consent extends DomainResource {
else if (name.equals("dateTime")) {
throw new FHIRException("Cannot call addChild on a primitive type Consent.dateTime");
}
else if (name.equals("consentingParty")) {
return addConsentingParty();
else if (name.equals("performer")) {
return addPerformer();
}
else if (name.equals("organization")) {
return addOrganization();
@ -3483,7 +3395,11 @@ public class Consent extends DomainResource {
public Consent copy() {
Consent dst = new Consent();
copyValues(dst);
dst.identifier = identifier == null ? null : identifier.copy();
if (identifier != null) {
dst.identifier = new ArrayList<Identifier>();
for (Identifier i : identifier)
dst.identifier.add(i.copy());
};
dst.status = status == null ? null : status.copy();
dst.scope = scope == null ? null : scope.copy();
if (category != null) {
@ -3493,10 +3409,10 @@ public class Consent extends DomainResource {
};
dst.patient = patient == null ? null : patient.copy();
dst.dateTime = dateTime == null ? null : dateTime.copy();
if (consentingParty != null) {
dst.consentingParty = new ArrayList<Reference>();
for (Reference i : consentingParty)
dst.consentingParty.add(i.copy());
if (performer != null) {
dst.performer = new ArrayList<Reference>();
for (Reference i : performer)
dst.performer.add(i.copy());
};
if (organization != null) {
dst.organization = new ArrayList<Reference>();
@ -3532,7 +3448,7 @@ public class Consent extends DomainResource {
Consent o = (Consent) other_;
return compareDeep(identifier, o.identifier, true) && compareDeep(status, o.status, true) && compareDeep(scope, o.scope, true)
&& compareDeep(category, o.category, true) && compareDeep(patient, o.patient, true) && compareDeep(dateTime, o.dateTime, true)
&& compareDeep(consentingParty, o.consentingParty, true) && compareDeep(organization, o.organization, true)
&& compareDeep(performer, o.performer, true) && compareDeep(organization, o.organization, true)
&& compareDeep(source, o.source, true) && compareDeep(policy, o.policy, true) && compareDeep(policyRule, o.policyRule, true)
&& compareDeep(verification, o.verification, true) && compareDeep(provision, o.provision, true)
;
@ -3545,13 +3461,12 @@ public class Consent extends DomainResource {
if (!(other_ instanceof Consent))
return false;
Consent o = (Consent) other_;
return compareValues(status, o.status, true) && compareValues(scope, o.scope, true) && compareValues(dateTime, o.dateTime, true)
;
return compareValues(status, o.status, true) && compareValues(dateTime, o.dateTime, true);
}
public boolean isEmpty() {
return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, status, scope
, category, patient, dateTime, consentingParty, organization, source, policy, policyRule
, category, patient, dateTime, performer, organization, source, policy, policyRule
, verification, provision);
}
@ -3720,7 +3635,7 @@ public class Consent extends DomainResource {
* Path: <b>Consent.provision.actor.reference</b><br>
* </p>
*/
@SearchParamDefinition(name="actor", path="Consent.provision.actor.reference", description="Resource for the actor (or group, by role)", type="reference", target={CareTeam.class, Device.class, Group.class, Organization.class, Patient.class, Practitioner.class, RelatedPerson.class } )
@SearchParamDefinition(name="actor", path="Consent.provision.actor.reference", description="Resource for the actor (or group, by role)", type="reference", target={CareTeam.class, Device.class, Group.class, Organization.class, Patient.class, Practitioner.class, PractitionerRole.class, RelatedPerson.class } )
public static final String SP_ACTOR = "actor";
/**
* <b>Fluent Client</b> search parameter constant for <b>actor</b>
@ -3835,17 +3750,17 @@ public class Consent extends DomainResource {
* <p>
* Description: <b>Who is agreeing to the policy and rules</b><br>
* Type: <b>reference</b><br>
* Path: <b>Consent.consentingParty</b><br>
* Path: <b>Consent.performer</b><br>
* </p>
*/
@SearchParamDefinition(name="consentor", path="Consent.consentingParty", description="Who is agreeing to the policy and rules", type="reference", target={Organization.class, Patient.class, Practitioner.class, RelatedPerson.class } )
@SearchParamDefinition(name="consentor", path="Consent.performer", description="Who is agreeing to the policy and rules", type="reference", target={Organization.class, Patient.class, Practitioner.class, PractitionerRole.class, RelatedPerson.class } )
public static final String SP_CONSENTOR = "consentor";
/**
* <b>Fluent Client</b> search parameter constant for <b>consentor</b>
* <p>
* Description: <b>Who is agreeing to the policy and rules</b><br>
* Type: <b>reference</b><br>
* Path: <b>Consent.consentingParty</b><br>
* Path: <b>Consent.performer</b><br>
* </p>
*/
public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam CONSENTOR = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_CONSENTOR);

View File

@ -29,12 +29,12 @@ package org.hl7.fhir.r4.model;
*/
// Generated on Tue, Jan 9, 2018 14:51-0500 for FHIR v3.2.0
// Generated on Thu, Mar 1, 2018 20:26+1100 for FHIR v3.2.0
public class Constants {
public final static String VERSION = "3.2.0";
public final static String REVISION = "12899";
public final static String DATE = "Tue Jan 09 14:51:00 EST 2018";
public final static String REVISION = "13231";
public final static String DATE = "Thu Mar 01 20:26:54 AEDT 2018";
}

View File

@ -29,7 +29,7 @@ package org.hl7.fhir.r4.model;
*/
// Generated on Tue, Jan 9, 2018 14:51-0500 for FHIR v3.2.0
// Generated on Thu, Mar 1, 2018 20:26+1100 for FHIR v3.2.0
import java.util.*;

View File

@ -29,7 +29,7 @@ package org.hl7.fhir.r4.model;
*/
// Generated on Tue, Jan 9, 2018 14:51-0500 for FHIR v3.2.0
// Generated on Thu, Mar 1, 2018 20:26+1100 for FHIR v3.2.0
import java.util.*;

View File

@ -29,7 +29,7 @@ package org.hl7.fhir.r4.model;
*/
// Generated on Tue, Jan 9, 2018 14:51-0500 for FHIR v3.2.0
// Generated on Thu, Mar 1, 2018 20:26+1100 for FHIR v3.2.0
import java.util.*;
@ -4210,9 +4210,9 @@ public class Contract extends DomainResource {
/**
* Unique identifier for this Contract or a derivative that references a Source Contract.
*/
@Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=1, modifier=false, summary=true)
@Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
@Description(shortDefinition="Contract number", formalDefinition="Unique identifier for this Contract or a derivative that references a Source Contract." )
protected Identifier identifier;
protected List<Identifier> identifier;
/**
* The status of the resource instance.
@ -4338,7 +4338,7 @@ public class Contract extends DomainResource {
@Description(shortDefinition="Binding Contract", formalDefinition="Legally binding Contract: This is the signed and legally recognized representation of the Contract, which is considered the \"source of truth\" and which would be the basis for legal action related to enforcement of this Contract." )
protected Type legallyBinding;
private static final long serialVersionUID = 257749955L;
private static final long serialVersionUID = 1347256849L;
/**
* Constructor
@ -4350,25 +4350,54 @@ public class Contract extends DomainResource {
/**
* @return {@link #identifier} (Unique identifier for this Contract or a derivative that references a Source Contract.)
*/
public Identifier getIdentifier() {
public List<Identifier> getIdentifier() {
if (this.identifier == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create Contract.identifier");
else if (Configuration.doAutoCreate())
this.identifier = new Identifier(); // cc
this.identifier = new ArrayList<Identifier>();
return this.identifier;
}
/**
* @return Returns a reference to <code>this</code> for easy method chaining
*/
public Contract setIdentifier(List<Identifier> theIdentifier) {
this.identifier = theIdentifier;
return this;
}
public boolean hasIdentifier() {
return this.identifier != null && !this.identifier.isEmpty();
if (this.identifier == null)
return false;
for (Identifier item : this.identifier)
if (!item.isEmpty())
return true;
return false;
}
public Identifier addIdentifier() { //3
Identifier t = new Identifier();
if (this.identifier == null)
this.identifier = new ArrayList<Identifier>();
this.identifier.add(t);
return t;
}
public Contract addIdentifier(Identifier t) { //3
if (t == null)
return this;
if (this.identifier == null)
this.identifier = new ArrayList<Identifier>();
this.identifier.add(t);
return this;
}
/**
* @param value {@link #identifier} (Unique identifier for this Contract or a derivative that references a Source Contract.)
* @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist
*/
public Contract setIdentifier(Identifier value) {
this.identifier = value;
return this;
public Identifier getIdentifierFirstRep() {
if (getIdentifier().isEmpty()) {
addIdentifier();
}
return getIdentifier().get(0);
}
/**
@ -5090,7 +5119,7 @@ public class Contract extends DomainResource {
protected void listChildren(List<Property> children) {
super.listChildren(children);
children.add(new Property("identifier", "Identifier", "Unique identifier for this Contract or a derivative that references a Source Contract.", 0, 1, identifier));
children.add(new Property("identifier", "Identifier", "Unique identifier for this Contract or a derivative that references a Source Contract.", 0, java.lang.Integer.MAX_VALUE, identifier));
children.add(new Property("status", "code", "The status of the resource instance.", 0, 1, status));
children.add(new Property("contentDerivative", "CodeableConcept", "The minimal content derived from the basal information source at a specific stage in its lifecycle.", 0, 1, contentDerivative));
children.add(new Property("issued", "dateTime", "When this Contract was issued.", 0, 1, issued));
@ -5111,7 +5140,7 @@ public class Contract extends DomainResource {
@Override
public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
switch (_hash) {
case -1618432855: /*identifier*/ return new Property("identifier", "Identifier", "Unique identifier for this Contract or a derivative that references a Source Contract.", 0, 1, identifier);
case -1618432855: /*identifier*/ return new Property("identifier", "Identifier", "Unique identifier for this Contract or a derivative that references a Source Contract.", 0, java.lang.Integer.MAX_VALUE, identifier);
case -892481550: /*status*/ return new Property("status", "code", "The status of the resource instance.", 0, 1, status);
case -92412192: /*contentDerivative*/ return new Property("contentDerivative", "CodeableConcept", "The minimal content derived from the basal information source at a specific stage in its lifecycle.", 0, 1, contentDerivative);
case -1179159893: /*issued*/ return new Property("issued", "dateTime", "When this Contract was issued.", 0, 1, issued);
@ -5138,7 +5167,7 @@ public class Contract extends DomainResource {
@Override
public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
switch (hash) {
case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : new Base[] {this.identifier}; // Identifier
case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<ContractStatus>
case -92412192: /*contentDerivative*/ return this.contentDerivative == null ? new Base[0] : new Base[] {this.contentDerivative}; // CodeableConcept
case -1179159893: /*issued*/ return this.issued == null ? new Base[0] : new Base[] {this.issued}; // DateTimeType
@ -5163,7 +5192,7 @@ public class Contract extends DomainResource {
public Base setProperty(int hash, String name, Base value) throws FHIRException {
switch (hash) {
case -1618432855: // identifier
this.identifier = castToIdentifier(value); // Identifier
this.getIdentifier().add(castToIdentifier(value)); // Identifier
return value;
case -892481550: // status
value = new ContractStatusEnumFactory().fromType(castToCode(value));
@ -5219,7 +5248,7 @@ public class Contract extends DomainResource {
@Override
public Base setProperty(String name, Base value) throws FHIRException {
if (name.equals("identifier")) {
this.identifier = castToIdentifier(value); // Identifier
this.getIdentifier().add(castToIdentifier(value));
} else if (name.equals("status")) {
value = new ContractStatusEnumFactory().fromType(castToCode(value));
this.status = (Enumeration) value; // Enumeration<ContractStatus>
@ -5259,7 +5288,7 @@ public class Contract extends DomainResource {
@Override
public Base makeProperty(int hash, String name) throws FHIRException {
switch (hash) {
case -1618432855: return getIdentifier();
case -1618432855: return addIdentifier();
case -892481550: return getStatusElement();
case -92412192: return getContentDerivative();
case -1179159893: return getIssuedElement();
@ -5308,8 +5337,7 @@ public class Contract extends DomainResource {
@Override
public Base addChild(String name) throws FHIRException {
if (name.equals("identifier")) {
this.identifier = new Identifier();
return this.identifier;
return addIdentifier();
}
else if (name.equals("status")) {
throw new FHIRException("Cannot call addChild on a primitive type Contract.status");
@ -5377,7 +5405,11 @@ public class Contract extends DomainResource {
public Contract copy() {
Contract dst = new Contract();
copyValues(dst);
dst.identifier = identifier == null ? null : identifier.copy();
if (identifier != null) {
dst.identifier = new ArrayList<Identifier>();
for (Identifier i : identifier)
dst.identifier.add(i.copy());
};
dst.status = status == null ? null : status.copy();
dst.contentDerivative = contentDerivative == null ? null : contentDerivative.copy();
dst.issued = issued == null ? null : issued.copy();

View File

@ -29,7 +29,7 @@ package org.hl7.fhir.r4.model;
*/
// Generated on Tue, Jan 9, 2018 14:51-0500 for FHIR v3.2.0
// Generated on Thu, Mar 1, 2018 20:26+1100 for FHIR v3.2.0
import java.util.*;

View File

@ -29,7 +29,7 @@ package org.hl7.fhir.r4.model;
*/
// Generated on Tue, Jan 9, 2018 14:51-0500 for FHIR v3.2.0
// Generated on Thu, Mar 1, 2018 20:26+1100 for FHIR v3.2.0
import java.util.*;

View File

@ -29,7 +29,7 @@ package org.hl7.fhir.r4.model;
*/
// Generated on Tue, Jan 9, 2018 14:51-0500 for FHIR v3.2.0
// Generated on Thu, Mar 1, 2018 20:26+1100 for FHIR v3.2.0
import java.util.*;
@ -664,9 +664,9 @@ public class DataRequirement extends Type implements ICompositeType {
/**
* The profile of the required data, specified as the uri of the profile definition.
*/
@Child(name = "profile", type = {UriType.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
@Child(name = "profile", type = {CanonicalType.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
@Description(shortDefinition="The profile of the required data", formalDefinition="The profile of the required data, specified as the uri of the profile definition." )
protected List<UriType> profile;
protected List<CanonicalType> profile;
/**
* Indicates that specific elements of the type are referenced by the knowledge module and must be supported by the consumer in order to obtain an effective evaluation. This does not mean that a value is required for this element, only that the consuming system must understand the element and be able to provide values for it if they are available. Note that the value for this element can be a path to allow references to nested elements. In that case, all the elements along the path must be supported.
@ -689,7 +689,7 @@ public class DataRequirement extends Type implements ICompositeType {
@Description(shortDefinition="What dates/date ranges are expected", formalDefinition="Date filters specify additional constraints on the data in terms of the applicable date range for specific elements. Each date filter specifies an additional constraint on the data, i.e. date filters are AND'ed, not OR'ed." )
protected List<DataRequirementDateFilterComponent> dateFilter;
private static final long serialVersionUID = 274786645L;
private static final long serialVersionUID = -1087515891L;
/**
* Constructor
@ -754,16 +754,16 @@ public class DataRequirement extends Type implements ICompositeType {
/**
* @return {@link #profile} (The profile of the required data, specified as the uri of the profile definition.)
*/
public List<UriType> getProfile() {
public List<CanonicalType> getProfile() {
if (this.profile == null)
this.profile = new ArrayList<UriType>();
this.profile = new ArrayList<CanonicalType>();
return this.profile;
}
/**
* @return Returns a reference to <code>this</code> for easy method chaining
*/
public DataRequirement setProfile(List<UriType> theProfile) {
public DataRequirement setProfile(List<CanonicalType> theProfile) {
this.profile = theProfile;
return this;
}
@ -771,7 +771,7 @@ public class DataRequirement extends Type implements ICompositeType {
public boolean hasProfile() {
if (this.profile == null)
return false;
for (UriType item : this.profile)
for (CanonicalType item : this.profile)
if (!item.isEmpty())
return true;
return false;
@ -780,10 +780,10 @@ public class DataRequirement extends Type implements ICompositeType {
/**
* @return {@link #profile} (The profile of the required data, specified as the uri of the profile definition.)
*/
public UriType addProfileElement() {//2
UriType t = new UriType();
public CanonicalType addProfileElement() {//2
CanonicalType t = new CanonicalType();
if (this.profile == null)
this.profile = new ArrayList<UriType>();
this.profile = new ArrayList<CanonicalType>();
this.profile.add(t);
return t;
}
@ -792,10 +792,10 @@ public class DataRequirement extends Type implements ICompositeType {
* @param value {@link #profile} (The profile of the required data, specified as the uri of the profile definition.)
*/
public DataRequirement addProfile(String value) { //1
UriType t = new UriType();
CanonicalType t = new CanonicalType();
t.setValue(value);
if (this.profile == null)
this.profile = new ArrayList<UriType>();
this.profile = new ArrayList<CanonicalType>();
this.profile.add(t);
return this;
}
@ -806,8 +806,8 @@ public class DataRequirement extends Type implements ICompositeType {
public boolean hasProfile(String value) {
if (this.profile == null)
return false;
for (UriType v : this.profile)
if (v.equals(value)) // uri
for (CanonicalType v : this.profile)
if (v.getValue().equals(value)) // canonical(StructureDefinition)
return true;
return false;
}
@ -868,7 +868,7 @@ public class DataRequirement extends Type implements ICompositeType {
if (this.mustSupport == null)
return false;
for (StringType v : this.mustSupport)
if (v.equals(value)) // string
if (v.getValue().equals(value)) // string
return true;
return false;
}
@ -982,7 +982,7 @@ public class DataRequirement extends Type implements ICompositeType {
protected void listChildren(List<Property> children) {
super.listChildren(children);
children.add(new Property("type", "code", "The type of the required data, specified as the type name of a resource. For profiles, this value is set to the type of the base resource of the profile.", 0, 1, type));
children.add(new Property("profile", "uri", "The profile of the required data, specified as the uri of the profile definition.", 0, java.lang.Integer.MAX_VALUE, profile));
children.add(new Property("profile", "canonical(StructureDefinition)", "The profile of the required data, specified as the uri of the profile definition.", 0, java.lang.Integer.MAX_VALUE, profile));
children.add(new Property("mustSupport", "string", "Indicates that specific elements of the type are referenced by the knowledge module and must be supported by the consumer in order to obtain an effective evaluation. This does not mean that a value is required for this element, only that the consuming system must understand the element and be able to provide values for it if they are available. Note that the value for this element can be a path to allow references to nested elements. In that case, all the elements along the path must be supported.", 0, java.lang.Integer.MAX_VALUE, mustSupport));
children.add(new Property("codeFilter", "", "Code filters specify additional constraints on the data, specifying the value set of interest for a particular element of the data. Each code filter defines an additional constraint on the data, i.e. code filters are AND'ed, not OR'ed.", 0, java.lang.Integer.MAX_VALUE, codeFilter));
children.add(new Property("dateFilter", "", "Date filters specify additional constraints on the data in terms of the applicable date range for specific elements. Each date filter specifies an additional constraint on the data, i.e. date filters are AND'ed, not OR'ed.", 0, java.lang.Integer.MAX_VALUE, dateFilter));
@ -992,7 +992,7 @@ public class DataRequirement extends Type implements ICompositeType {
public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
switch (_hash) {
case 3575610: /*type*/ return new Property("type", "code", "The type of the required data, specified as the type name of a resource. For profiles, this value is set to the type of the base resource of the profile.", 0, 1, type);
case -309425751: /*profile*/ return new Property("profile", "uri", "The profile of the required data, specified as the uri of the profile definition.", 0, java.lang.Integer.MAX_VALUE, profile);
case -309425751: /*profile*/ return new Property("profile", "canonical(StructureDefinition)", "The profile of the required data, specified as the uri of the profile definition.", 0, java.lang.Integer.MAX_VALUE, profile);
case -1402857082: /*mustSupport*/ return new Property("mustSupport", "string", "Indicates that specific elements of the type are referenced by the knowledge module and must be supported by the consumer in order to obtain an effective evaluation. This does not mean that a value is required for this element, only that the consuming system must understand the element and be able to provide values for it if they are available. Note that the value for this element can be a path to allow references to nested elements. In that case, all the elements along the path must be supported.", 0, java.lang.Integer.MAX_VALUE, mustSupport);
case -1303674939: /*codeFilter*/ return new Property("codeFilter", "", "Code filters specify additional constraints on the data, specifying the value set of interest for a particular element of the data. Each code filter defines an additional constraint on the data, i.e. code filters are AND'ed, not OR'ed.", 0, java.lang.Integer.MAX_VALUE, codeFilter);
case 149531846: /*dateFilter*/ return new Property("dateFilter", "", "Date filters specify additional constraints on the data in terms of the applicable date range for specific elements. Each date filter specifies an additional constraint on the data, i.e. date filters are AND'ed, not OR'ed.", 0, java.lang.Integer.MAX_VALUE, dateFilter);
@ -1005,7 +1005,7 @@ public class DataRequirement extends Type implements ICompositeType {
public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
switch (hash) {
case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeType
case -309425751: /*profile*/ return this.profile == null ? new Base[0] : this.profile.toArray(new Base[this.profile.size()]); // UriType
case -309425751: /*profile*/ return this.profile == null ? new Base[0] : this.profile.toArray(new Base[this.profile.size()]); // CanonicalType
case -1402857082: /*mustSupport*/ return this.mustSupport == null ? new Base[0] : this.mustSupport.toArray(new Base[this.mustSupport.size()]); // StringType
case -1303674939: /*codeFilter*/ return this.codeFilter == null ? new Base[0] : this.codeFilter.toArray(new Base[this.codeFilter.size()]); // DataRequirementCodeFilterComponent
case 149531846: /*dateFilter*/ return this.dateFilter == null ? new Base[0] : this.dateFilter.toArray(new Base[this.dateFilter.size()]); // DataRequirementDateFilterComponent
@ -1021,7 +1021,7 @@ public class DataRequirement extends Type implements ICompositeType {
this.type = castToCode(value); // CodeType
return value;
case -309425751: // profile
this.getProfile().add(castToUri(value)); // UriType
this.getProfile().add(castToCanonical(value)); // CanonicalType
return value;
case -1402857082: // mustSupport
this.getMustSupport().add(castToString(value)); // StringType
@ -1042,7 +1042,7 @@ public class DataRequirement extends Type implements ICompositeType {
if (name.equals("type")) {
this.type = castToCode(value); // CodeType
} else if (name.equals("profile")) {
this.getProfile().add(castToUri(value));
this.getProfile().add(castToCanonical(value));
} else if (name.equals("mustSupport")) {
this.getMustSupport().add(castToString(value));
} else if (name.equals("codeFilter")) {
@ -1071,7 +1071,7 @@ public class DataRequirement extends Type implements ICompositeType {
public String[] getTypesForProperty(int hash, String name) throws FHIRException {
switch (hash) {
case 3575610: /*type*/ return new String[] {"code"};
case -309425751: /*profile*/ return new String[] {"uri"};
case -309425751: /*profile*/ return new String[] {"canonical"};
case -1402857082: /*mustSupport*/ return new String[] {"string"};
case -1303674939: /*codeFilter*/ return new String[] {};
case 149531846: /*dateFilter*/ return new String[] {};
@ -1111,8 +1111,8 @@ public class DataRequirement extends Type implements ICompositeType {
copyValues(dst);
dst.type = type == null ? null : type.copy();
if (profile != null) {
dst.profile = new ArrayList<UriType>();
for (UriType i : profile)
dst.profile = new ArrayList<CanonicalType>();
for (CanonicalType i : profile)
dst.profile.add(i.copy());
};
if (mustSupport != null) {
@ -1155,8 +1155,7 @@ public class DataRequirement extends Type implements ICompositeType {
if (!(other_ instanceof DataRequirement))
return false;
DataRequirement o = (DataRequirement) other_;
return compareValues(type, o.type, true) && compareValues(profile, o.profile, true) && compareValues(mustSupport, o.mustSupport, true)
;
return compareValues(type, o.type, true) && compareValues(mustSupport, o.mustSupport, true);
}
public boolean isEmpty() {

View File

@ -29,19 +29,21 @@ POSSIBILITY OF SUCH DAMAGE.
package org.hl7.fhir.r4.model;
import ca.uhn.fhir.model.api.TemporalPrecisionEnum;
import ca.uhn.fhir.model.api.annotation.DatatypeDef;
import org.apache.commons.lang3.Validate;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.TimeZone;
/**
* Primitive type "date" in FHIR: any day in a gregorian calendar
*/
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.TimeZone;
import ca.uhn.fhir.model.api.TemporalPrecisionEnum;
import org.apache.commons.lang3.Validate;
import ca.uhn.fhir.model.api.annotation.DatatypeDef;
/**
* Represents a FHIR date datatype. Valid precisions values for this type are:
* <ul>

View File

@ -29,7 +29,7 @@ package org.hl7.fhir.r4.model;
*/
// Generated on Tue, Jan 9, 2018 14:51-0500 for FHIR v3.2.0
// Generated on Thu, Mar 1, 2018 20:26+1100 for FHIR v3.2.0
import java.util.*;

View File

@ -29,7 +29,7 @@ package org.hl7.fhir.r4.model;
*/
// Generated on Tue, Jan 9, 2018 14:51-0500 for FHIR v3.2.0
// Generated on Thu, Mar 1, 2018 20:26+1100 for FHIR v3.2.0
import java.util.*;

View File

@ -29,7 +29,7 @@ package org.hl7.fhir.r4.model;
*/
// Generated on Tue, Jan 9, 2018 14:51-0500 for FHIR v3.2.0
// Generated on Thu, Mar 1, 2018 20:26+1100 for FHIR v3.2.0
import java.util.*;

View File

@ -29,7 +29,7 @@ package org.hl7.fhir.r4.model;
*/
// Generated on Tue, Jan 9, 2018 14:51-0500 for FHIR v3.2.0
// Generated on Thu, Mar 1, 2018 20:26+1100 for FHIR v3.2.0
import java.util.*;

View File

@ -29,7 +29,7 @@ package org.hl7.fhir.r4.model;
*/
// Generated on Tue, Jan 9, 2018 14:51-0500 for FHIR v3.2.0
// Generated on Thu, Mar 1, 2018 20:26+1100 for FHIR v3.2.0
import java.util.*;
@ -950,7 +950,7 @@ public class DeviceRequest extends DomainResource {
if (this.instantiates == null)
return false;
for (UriType v : this.instantiates)
if (v.equals(value)) // uri
if (v.getValue().equals(value)) // uri
return true;
return false;
}

Some files were not shown because too many files have changed in this diff Show More